Display agent usage data - #118
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 360d5471a5
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0e67bf3567
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4c2d382d8
ℹ️ 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".
| if (!snapshot) return fileResponse(output, { live: true }); | ||
| const fingerprint = snapshot?.notes?.reviewFingerprint; | ||
| if (!fingerprint) return fileResponse(output, { live: true }); | ||
| const chatSummary = currentChatUsage(fingerprint); |
There was a problem hiding this comment.
Avoid resetting chat usage from stale snapshot reads
When refreshes overlap while the review file is replaced, an earlier readFile can return the old fingerprint after a later request has already initialized and recorded usage for the new review. Calling the mutating currentChatUsage(fingerprint) from this response path then switches the global accumulator back to the old review and discards those new-review totals; the frontend's request-order guard cannot prevent this server-side mutation. Only reset usage from the authoritative refreshed chat state, or reject snapshot fingerprints that no longer match it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 2884df5. Snapshot responses now use a non-mutating usage lookup; only an authoritative chat refresh or a fingerprint-guarded provider event may reset the accumulator. A deterministic read-barrier regression proves a stale response cannot erase the current Review’s chat totals. The full suite passed before the latest main merge, and the merged server/chat/presentation suite passes 47/47.
# Conflicts: # tests/browser/review-journey.test.mjs
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
# Conflicts: # app/globals.css # scripts/present.mjs # tests/review-chat.test.mjs
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2884df50e9
ℹ️ 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".
| function recordChatUsage({ reviewFingerprint, usage }) { | ||
| if ( | ||
| !reviewFingerprint || | ||
| reviewChat?.getState().fingerprint !== reviewFingerprint | ||
| ) { |
There was a problem hiding this comment.
Fence chat usage against the on-disk review
When the snapshot is replaced while a chat provider is running and the child exits before the 100 ms file watcher refreshes reviewChat, this in-memory fingerprint check still accepts the old review's usage. ChildExecution.reportUsage() runs before the provider promise settles and the controller performs its synchronous snapshot fence, so snapshotNoteUsage() can then read the new review and print a combined terminal total containing old-review chat tokens and new-review note tokens. Compare or refresh against the snapshot fingerprint before recording and formatting this usage.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 47134b8 and included in current merge head dbf9c43. recordChatUsage now synchronously reads the published snapshot once and requires its on-disk Review fingerprint, as well as the in-memory chat fingerprint, to match the initiating provider event before recording, formatting, or broadcasting usage. The same parsed snapshot supplies Agent-note totals, preventing mixed-review terminal output. A deterministic gated-provider regression advances the published Review while chat state remains stale and verifies that no usage is logged or attributed. The complete post-merge suite passes: unit 201/201, integration 144/144, coverage 154/154, browser 26/26, platform 3/3.
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
What changed
Verification
pnpm run lint— passed (one existing generated coverage warning)pnpm run docs:check— passed with 0 errors, warnings, hints, or broken linkspnpm test— passed on the latest merged head: unit 201/201, integration 144/144, coverage 154/154, browser 26/26, platform 3/3UI proof
Captured from the final usage layout on
da23bd62f5479fa3034d04f8a67687e9826b745a. Later commits only fence server-side usage state and merge upstream picker-progress/release-workflow changes.Collapsed by default beneath the Agent note:
Expanded usage details:
Closes #107