Repository navigation
fix(usage): retain Kiro prompt estimates in hosted tool paths (carry #7620) - #7744
Conversation
Carry of #7620 onto current dev. The hosted web-search and image/video sidecar paths now record the adapter's usageLog.inputTokens estimate in onRequestBuilt, matching ordinary adapter dispatch. Co-authored-by: Martin Becerra <197874+martinbcg@users.noreply.github.com>
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. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Capture sidecar prompt estimates src/server/responses/sidecar-execution.ts, structure/transports/responses.md, docs-site/src/content/docs/reference/adapters.md |
The image and web-search callbacks copy numeric input-token estimates from built requests into the usage log context. The ownership notes and Kiro usage documentation describe per-build prompt estimates. |
Verify usage accounting tests/responses/responses-sidecar-usage.test.ts, tests/fixtures/test-layout-expected.json, scripts/test-layout/layout-adapters.json |
Tests cover requests without sidecars and with web-search or image tools. They check response success, one dispatch, estimated request and attempt usage above 20,000 input tokens, and matching daily totals. Test layout mappings register the test. |
Priority:
Estimated code review effort: 2 (Simple) | ~15 minutes
Change: Bug fix
Possibly related PRs
- lidge-jun/opencodex#7620: Adds the same sidecar input-token propagation that this pull request tests.
Merge Risk: 
Minimal · up to 41607
-
The reviewed change has no identified merge-blocking correctness, accounting, security, or availability issue.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
✅ Deterministic PR hygiene checks passed. |
Avoid a new explicitShards entry that collides with #7635's layout-server shard. Co-authored-by: Martin Becerra <197874+martinbcg@users.noreply.github.com>
|
Maintainer integration decision for v2.93.0 (lane L-D1): merging into
This carries #7620 by @martinbcg; the squash keeps the Co-authored-by trailer. |
Summary
Carries #7620 by @martinbcg onto current
dev(the original is a 45-behind author draft). The Responses hosted web-search and image/video paths built adapter requests without recording the adapter's prompt estimate (usageLog.inputTokens), so for Kiro a request that merely declaredweb_searchorimage_generationlogged only the new turn's few tokens instead of the full replayed prompt. BothonRequestBuiltcallbacks insrc/server/responses/sidecar-execution.tsnow record it, matching ordinary adapter dispatch. Usage totals, per-model input, physical-attempt usage and daily activity are affected; client compaction accounting is not.The adapter reference and the transport ownership row are updated. Source change is identical to #7620; only the base moved.
Verification
Windows, pinned Bun 1.4.4, on this exact tree:
sidecar-execution.tsreverted toorigin/dev,tests/responses/responses-sidecar-usage.test.tsgives 1 pass / 2 fail (web-search and images undercount); with the fix, 3 pass.bun test tests/responses/responses-sidecar-usage.test.ts tests/test-layout.test.ts tests/test-layout-tooling.test.ts: 32 pass, 0 fail.bun x tsc --noEmit: exit 0.bun run structure:check: passed.Full local suite NOT RUN (shared-host resource exception); hosted Ubuntu shards on this head cover the rest.
Checklist
Supersedes #7620.
Co-authored-by: Martin Becerra 197874+martinbcg@users.noreply.github.com
Summary by CodeRabbit