Skip to content

Fix session list cwd pagination - #329

Open
OldKrab wants to merge 7 commits into
agentclientprotocol:mainfrom
OldKrab:shushakov/fix-session-list-cwd
Open

OldKrab wants to merge 7 commits into
agentclientprotocol:mainfrom
OldKrab:shushakov/fix-session-list-cwd

Conversation

@OldKrab

@OldKrab OldKrab commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • forward ACP's session/list cwd filter to Codex App Server's thread/list
  • apply the filter before App Server pagination and cursor generation
  • match Codex CLI ordering with sortKey: "updated_at" and sortDirection: "desc"
  • leave limit unset so App Server keeps its default page size
  • cover both legacy string-only and newer string-or-array cwd handling
  • keep the local path normalization of the returned page (Windows paths, basename filters)

Root cause

CodexAcpClient.listSessions requests a global App Server page, then filters that page locally by cwd. A requested workspace can therefore receive an empty page with a nextCursor belonging to unrelated global results even when matching sessions exist on later pages.

Passing the scalar ACP cwd through to thread/list is compatible with both App Server forms and makes the returned page and cursor belong to the filtered result set.

The request also uses the same updated-at descending ordering as Codex CLI. The CWD, opaque cursor, and ordering parameters are forwarded on every page without specifying a page-size limit.

Relation to the sessionIndex extension

#590 already filters by cwd in App Server for clients that declare sessionIndex. This change applies the same filtering to the plain session/list path used by every other client. It therefore changes the request pinned by session-index-list-params-legacy.json; the snapshot is updated to include cwd, sortKey, and sortDirection.

Verification

  • npx vitest run src/__tests__/CodexACPAgent/list-sessions.test.ts src/__tests__/CodexACPAgent/session-index.test.ts
  • npm run typecheck
  • npm test (1500 passed, 36 skipped)

@OldKrab
OldKrab marked this pull request as ready for review July 22, 2026 11:16
@irh irh mentioned this pull request Aug 29, 2026
Keep the state-DB-only listing and forward cwd and CLI ordering with it.
Drop the diagnostics guard and its test: upstream removed the diagnostics.
Update the legacy thread/list snapshot for the forwarded parameters.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant