feat(messages): config-level default for responseUsage (persistent /usage footer)#89762
Conversation
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
|
Codex review: needs real behavior proof before merge. Reviewed June 24, 2026, 8:58 AM ET / 12:58 UTC. Summary PR surface: Source +183, Tests +465, Docs +64, Generated 0. Total +712 across 37 files. Reproducibility: yes. at source level for the remaining delivery gap: PR head wires Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land only after maintainers accept the public config key, follow-up delivery either uses the same resolver or the scope is explicitly narrowed, and current-head real transport proof covers default, explicit off, and reset-to-inherit. Do we have a high-confidence way to reproduce the issue? Yes, at source level for the remaining delivery gap: PR head wires Is this the best way to solve the issue? No, not merge-ready yet. The shared resolver and explicit-off semantics are a good direction, but the best fix needs the public config contract, follow-up delivery scope, and current-head proof aligned. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ae9474b5fdc0. Label changesLabel justifications:
Evidence reviewedPR surface: Source +183, Tests +465, Docs +64, Generated 0. Total +712 across 37 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Mantis Telegram Desktop ProofSummary: Mantis captured native Telegram Desktop before/after GIFs showing the response usage config update.
Motion-trimmed clips: |
|
A sample layer translation file (user generated -- with agent assistance). Showcasing some capabilities of the atomic outputs such as temp-scale emojis, status emojis or meter bars. |
Review repair: explicit
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review The previous re-review run (27587112194) was cancelled before it could finish, so the verdict was never posted. The off-vs-inherit fix is on branch head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Real behavior proof — live
|
|
@clawsweeper re-review — body updated: added the Real behavior proof section heading with the embedded |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Adds `messages.responseUsage` (precedence session -> channel -> config default -> off) so the persistent /usage footer can default-on, with three distinct states: explicit on (tokens/full), explicit off (persisted), and unset (inherit the configured default). Unifies effective-value resolution behind a single channel-aware resolver `resolveEffectiveResponseUsage` used by reply rendering, the no-arg /usage toggle, the ACP control, and the gateway session-row builder; the row builder's `effectiveResponseUsage` is carried through sessions.changed events, chat snapshots, and the UI row so live consumers never go stale. `/usage reset` (aliases inherit/clear/default) clears the override to inherit; only explicit off persists; a full session reset preserves the preference. ACP "Usage detail" gains an "inherit" option for unset sessions. Docs/help/completions updated; "on" documented as a legacy alias; config-doc baseline regenerated.
|
Landed via rebase onto main.
Thanks @Marvinthebored! |





What Problem This Solves
The persistent
/usagefooter had no config-level default: users had to re-enable it per session, and the effective value was resolved ad-hoc per surface (reply rendering, ACP, TUI, no-arg toggle), so those surfaces could disagree. This adds amessages.responseUsagedefault with a single channel-aware resolver and a consistent projection everywhere.Summary
Adds a config-level default for the persistent
/usagefooter (messages.responseUsage) with precedence session → channel → config default → off, and makes the effective value consistent across every surface.Three distinct, documented session states:
tokens/full) — wins over any default,Maintainer-ready classification
messages.responseUsage(string or per-channel map) and an optionaleffectiveResponseUsageprojection on gateway session rows./usagehad to be re-enabled per session; and the effective value was resolved ad-hoc per surface, so reply rendering, the toggle, ACP, and TUI could disagree.resolveEffectiveResponseUsage(channel-aware) feeds every surface, centralized inbuildGatewaySessionRow; events/snapshots/UI consume the row-built value rather than re-resolving.unset(absent) is kept distinct from explicit"off"end-to-end."on"documented as a legacy alias; back-compatible (the new fields are optional).Addresses the requested rank-up moves
resolveEffectiveResponseUsageresolver; the ACP "Usage detail" control now showsinheritfor unset (distinct fromoff); the TUI no-arg toggle cycles from the channel-aware effective value, carried on session rows +sessions.changedevents + snapshots + the UI row so it never goes stale./usage reset(aliasesinherit/clear/default) clears the override to inherit the default; only explicitoffpersists; a full session reset preserves the preference. Documented indocs/concepts/usage-tracking.md(+ token-use / slash-commands / tui docs and help strings).sessions.changedmutation event, plus the live/usagecapture under Real behavior proof below.offstill suppresses, andfullmode renders through the usage template without exposing raw session keys.Tests and validation
node scripts/run-tsgo.mjs -p tsconfig.core.json— 0 errors.node scripts/generate-config-doc-baseline.ts --check— OK (baseline regenerated).vitest runacross the touched suites (resolver, ACP config-change, TUI command-handlers/session-actions, gateway session-utils,server.sessions.list-changed, embedded-backend, …) — green. Key assertions: config default applies when unset; explicitoffpersists and is not overridden by the default; clear/reset returns to inherit; per-channelmessages.responseUsagemap respected;sessions.changedcarries the resolvedeffectiveResponseUsage(distinct from rawundefined).node scripts/run-vitest.mjs src/auto-reply/reply/followup-runner.test.ts src/auto-reply/reply/agent-runner.misc.runreplyagent.test.ts src/auto-reply/reply/commands-session-usage.test.ts src/auto-reply/thinking.test.ts src/gateway/sessions-patch.test.ts src/gateway/session-utils.test.ts src/acp/translator.session-config.test.ts src/tui/tui-command-handlers.test.ts src/auto-reply/reply/reply-usage-state.test.ts— green, including follow-up responseUsage default/full/off coverage.Evidence
telegram-e2e-bot-to-botmock SUT probe on PR checkout: driver message38967, threaded SUT reply38968, mock OpenAI requests1, observedOPENCLAW_E2E_OKplusUsage: 11 in / 7 out.Redacted live
/usagecapture on a build carrying these changes (Discord, opus-4-8): full footer by default, then/usage offremoves it on the next reply. Scope note: this proves footer rendering and that explicit/usage offpersists; the configured-default and clear-to-inherit paths are proven by the tests above.After-fix evidence: