Skip to content

feat: expose stored transcript text for Air session search - #808

Open
osdm wants to merge 3 commits into
agentclientprotocol:mainfrom
osdm:air/session-search-text
Open

osdm wants to merge 3 commits into
agentclientprotocol:mainfrom
osdm:air/session-search-text

Conversation

@osdm

@osdm osdm commented Nov 26, 2026 •

Copy link
Copy Markdown

Air can list older Codex sessions, but metadata alone cannot find matches in their messages. Add negotiated sessionTranscriptText support to _session/batch_get for ACP v1 and v2, so clients can request a cheap revision or a bounded text snapshot before opening a session.

The extension requires one session ID and its absolute cwd. Read user and assistant text through app-server item pages, with a bounded full-history read for legacy sessions. Support archived sessions and compressed rollouts, and exclude tools, reasoning and non-text input. Ordinary metadata requests keep their existing response shape.

Successful projections use fixed limits: 4 MiB of messages and 10,000 raw items, including omitted tools and reasoning. Legacy input is limited to 64 MiB uncompressed. These limits can return truncated: true; response speed does not choose how much text is cached under a revision.

A shared 60-second deadline covers history reading and final verification. Timeout returns -32603 with data.reason: "transcriptReadTimeout", without a snapshot; clients should retry later with backoff. A source change after the initial file revision returns -32603 with data.reason: "transcriptChanged", allowing an immediate retry. A transcript missing before the initial revision returns no row.

Check the source metadata in legacy full-history responses and recheck the selected rollout and file revision before returning. This catches legacy A-to-B-to-A changes without another RPC. Paginated item responses have no rollout identity, so detecting arbitrary A-to-B-to-A changes between checks still requires app-server support; this limitation is documented.

Cancellation promptly stops waiting and further paging. App-server history reads have no cancellation RPC, so an already submitted read can finish in the background. Compaction markers without summary text preserve available messages and mark the projection as truncated.

Measurements

Codex 0.171.0 and Node.js 25.9.0 on macOS arm64 / Apple M4 Max. Eight synthetic cases cover files just below 4/64 MiB, message-heavy and tool-heavy histories, plain and zstd. Each case used a fresh app-server, an initial metadata lookup, one first full-history read and three repeats, followed by one warm adapter snapshot. No model requests were involved.

The largest native read was 116.31 ms; the largest warm adapter snapshot was 133.14 ms. The 60-second hang guard leaves substantial headroom. The OS file cache was not flushed, and the fixture text was repetitive and highly compressible. The first-read measurement represents a fresh app-server, not physical cold-storage I/O; these results are not a latency guarantee for all machines or storage. The legacy tool corpus returned only its seed user message, although its raw tool-call bytes were still read from the file.

Validation

  • npm run typecheck
  • npm test: 2,836 passed, 39 skipped.
  • 78 focused tests covering ACP v1/v2 error reasons, identical snapshots at different page speeds and sizes, disappearing files, legacy source changes, and late success/error after cancellation.
  • Real app-server integration test: src/__tests__/integration/session-batch-get.test.ts (old, archived and compressed history).
  • run-codex smoke test with real Codex: the turn completed successfully.
  • npm run build

Air can search stored Codex messages before it opens a session. The negotiated
extension serves revisions and bounded snapshots through the existing batch API.

The app-server reads old and archived history, including compressed rollouts.
Compaction markers without summary text keep available matches and mark the
snapshot incomplete.

Tests:
- TypeScript checks and 107 unit and wire tests passed.
- The real app-server test passed for old, archived, and compressed history.
- The bundle build and independent ACP v1 and v2 checks passed.

Evidence:
- Equal-size edits with a restored modification time change the revision.
- Stored snapshots exclude tools and reasoning.

Left out:
- Publishing and a first released version remain separate operations.

@slapoguzov slapoguzov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a wire test on v1 and v2, switching the selected rollout during a read returned the new text with the old revision. Could we recheck which rollout the session points to before returning, and cover this case with a regression test?

The 4 MiB limit counts returned text. If most pages contain only tool calls, what bounds the number of pages read, and can cancelling the search stop an in-flight read? Could a scan that hits its limit return truncated: true?

@osdm
osdm force-pushed the air/session-search-text branch from 186a790 to 5e4c3e6 Compare November 28, 2026 02:50
@osdm
osdm force-pushed the air/session-search-text branch from 5e4c3e6 to 2f9b18d Compare November 28, 2026 03:13

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.

2 participants