fix(gateway): async session transcript IO#75875
Conversation
|
Codex review: needs changes before merge. What this changes: The PR adds async/bounded session transcript readers and serialized transcript append helpers, rewires Gateway/session/TUI/agent callers to await them, adds transcript index/cache tests, and documents the Gateway/session performance fix in the changelog. Required change before merge: There is a narrow, actionable repair: add incomplete-chain fallback coverage for the new async bounded tree-tail reader, then run focused transcript/history tests. The protected label and failing CI still require maintainer review before merge. Security review: Security review cleared: The diff does not add dependencies, workflow execution, package resolution changes, secret handling, or new external code execution paths. Review findings:
Review detailsBest possible solution: Keep the async reader/append direction, but preserve Do we have a high-confidence way to reproduce the issue? Yes. The underlying issue is reproducible from #75656 by creating large session JSONL histories and hitting Is this the best way to solve the issue? No, not yet. The proposed async conversion is the right solution class, but the current bounded tree-tail implementation can drop valid history when the active branch cannot be reconstructed from the tail chunk alone. Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 5046cbc6f99a. |
aac97f9 to
ee50198
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aac97f9e15
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const snapshot = readRecentSessionUsageFromTranscript( | ||
| entry.sessionId, | ||
| params.storePath, | ||
| entry.sessionFile, | ||
| agentId, | ||
| typeof params.maxTranscriptBytes === "number" ? params.maxTranscriptBytes : 256 * 1024, | ||
| ); |
There was a problem hiding this comment.
Keep uncapped usage fallback on full transcript scan
Switching the default path to readRecentSessionUsageFromTranscript(..., 256 * 1024) drops usage metadata whenever the newest assistant usage block falls outside the last 256 KiB (for example after very large recent user/tool content). Before this commit, the uncapped path read the full transcript and still surfaced totalTokens/estimatedCostUsd; now affected sessions return null usage and session rows/events lose these fields despite valid historical usage data.
Useful? React with 👍 / 👎.
aed2fda to
1feaafa
Compare
* fix(gateway): async session transcript IO * fix(plugins): restore jiti loader cache helper * test(gateway): mock async artifact transcript reads * chore(plugins): drop obsolete jiti loader shim
* fix(gateway): async session transcript IO * fix(plugins): restore jiti loader cache helper * test(gateway): mock async artifact transcript reads * chore(plugins): drop obsolete jiti loader shim
No description provided.