Repository navigation
fix(status): empty --agent silently reports the default agent's usage - #193336
Conversation
An explicit empty --agent was dropped by truthy spreads before the existing agent-scope guard could see it, so status --usage reported the default agent's usage with exit 0 while any non-empty unknown id failed. Reject blank values in assertStatusUsageAgentScope, the shared entry guard both status entry points already call, and refresh the test-lines ceiling for the regression plus main's pre-existing 4-line shortfall.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesReject explicitly blank status --agent selectors before collecting status, and document the existing usage-only scope. Example: Run openclaw status --usage --agent "".
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a concrete bug still present on current main with a minimal shared validation change; no actionable code findings remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe status CLI passes agent selectors to a shared guard before text or JSON collection; valid selectors subsequently determine the credentials used for provider usage. flowchart TD
A[Status CLI options] --> B[Shared selector guard]
B --> C[Invalid selector error]
B --> D[Text or JSON status scan]
D --> E[Agent scoped usage resolver]
E --> F[Status report]
Technical reviewBest possible solution: Retain the shared early rejection and consolidated regression, then land through the existing PR gates. Do we have a high-confidence way to reproduce the issue? Current-main source shows the empty selector being dropped before downstream validation, and the posted built-CLI comparison records that exact failure and its corrected result. Is this the best way to solve the issue? This is the smallest complete fix: preserve the existing guard as the decision owner and reject explicit blanks before either status format scans or resolves usage. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 67afd9951b93. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +3, Tests 0, Docs +3. Total +6 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed November 5, 2026, 7:02 AM ET / 12:02 UTC (Revision 3). |
Per review: restore the shared test-lines scalar and track this regression's ten lines as a dedicated allocation; the inherited four-line shortfall stays separate for maintenance.
|
Addressed both findings on 1. Test-lines ceiling (P2) — restored Measured numbers for the inherited debt this PR deliberately does not absorb: For completeness: CI runs 2. Proof-host redaction — replaced the concrete address with Code, tests, and shipped-CLI evidence are untouched by this bookkeeping-only follow-up. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
Built Linux CLI regression proofPreserved @wangmiao0668000666's production fix. Frozen main Separate explicit profiles, HOME/state/config/workspaces; exact binaries printed resolved config and agent SQLite paths under Observed 14 status calls per build (JSON and text, seven cases each):
Actual successful JSON usage was Harness capture corrections: initial assertions assumed all text errors exposed their underlying message, then that every text error used the wrapper. Actual CLI errors use both. Both actual stdout/stderr are retained; final assertions accept each existing presentation. The final cross-build comparison also normalizes the intentional distinct profile names; it reuses recorded calls rather than rerunning the product. Artifacts retained locally under Focused verification: 27 tests passed across Simplification: one shared existing guard owns validation, no new machinery. Whole-PR production +3/-0; tests +7/-7 (net 0); docs +3/-0. Removed the contributor's allocation file entirely; both distinct regression boundaries remain covered. |
|
🦞👀 Re-review progress:
|
|
Landed in f2ddf6b. Thanks @wangmiao0668000666. Status usage now rejects a blank agent instead of showing the default. |
…openclaw#193336) fix(status): reject an explicit blank agent for usage An explicitly blank `--agent` on the status usage command was dropped before validation, so the command silently showed the default agent's usage. The blank value now reaches the existing agent validator and is rejected with its existing message, as `templates` does after openclaw#192726 and openclaw#192934. Omitted, valid and unknown agents and the no-usage case are unchanged. Evidence: built Linux CLI, text and JSON output. Main silently accepted the blank selection; with this change it is rejected in both formats. Omitted, valid, unknown-agent and no-usage controls are unchanged. Details: openclaw#193336 (comment). Thanks @wangmiao0668000666. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
An explicitly empty
openclaw status --usage --agent ""is discarded by a truthy spread before the existing usage validator, silently reporting default-agent usage instead of rejecting the invalid selector.Fix
Keep @wangmiao0668000666's three-line fix in the existing shared
assertStatusUsageAgentScopeguard. Both text and JSON status call this guard before scanning. It reuses the existing--agent must not be blankerror; the existing--agent is only valid with --usageprecedence remains unchanged. No caller rewrite, new configuration, auth, schema, retry guidance, or model-facing text.Consolidate the old no-usage regression and blank-selector regression into the same two-row matrix, preserving both rejection and before-scan assertions. Remove the test-line allocation file. Document the invalid explicit-empty selector in the existing CLI page.
Evidence
Built Linux CLI proof and focused-check receipt: 28 status calls across main/candidate and both JSON/text formats, all controls equivalent; 27 focused tests, typed lint, focused test typecheck, and formatter passed. Proof uses the shipped
openclaw.mjsentry point in secretlessnode:24.22.1, separate explicit profiles/config/state/workspaces, and verifies resolved config and agent database paths. No live quota numbers or real-provider credentials are claimed.Whole-change deltas against merge base: production +3/-0; tests +7/-7 (net 0); docs +3/-0. No test-line allocation remains.
Merge risk
Low: the only production change rejects an explicitly supplied blank selector before scanning. Omitted selectors and configured/unknown nonempty selectors retain their existing behavior. Existing no-usage validation retains precedence. Reverting restores the previous accidental default-agent fallback for a blank selector; no persistent data, configuration, or protocol migration is involved.