Skip to content

fix(status): empty --agent silently reports the default agent's usage - #193336

Merged
obviyus merged 3 commits into
openclaw:mainfrom
wangmiao0668000666:fix/status-blank-agent
Nov 5, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
wangmiao0668000666:fix/status-blank-agent

Conversation

@wangmiao0668000666

@wangmiao0668000666 wangmiao0668000666 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

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 assertStatusUsageAgentScope guard. Both text and JSON status call this guard before scanning. It reuses the existing --agent must not be blank error; the existing --agent is only valid with --usage precedence 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.mjs entry point in secretless node: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.

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.
@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: XS labels Nov 5, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 5, 2026
@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Reject explicitly blank status --agent selectors before collecting status, and document the existing usage-only scope.

Example: Run openclaw status --usage --agent "".

  • Before: Exits successfully and reports default-agent usage availability.
  • After: Exits with an error: --agent must not be blank.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, complete repair with shipped-CLI before/after evidence, a meaningful regression, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The posted Linux Docker proof exercises built openclaw.mjs artifacts with isolated profiles and state: blank selectors change from successful fallback to rejection in text and JSON, while omitted, configured, unknown, and no-usage controls retain behavior; final-head production bytes are unchanged from the proven candidate.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An explicitly empty agent selector silently falls back to default-agent usage instead of reporting invalid input.
Reason: The patch restores the existing blank-selector contract without changing valid selection, defaults, configuration, or persistent state.

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
Reviewed head: ab398cce60b5a0965ceba104f0b443152cc7b252

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit d5c194f adds src/commands/status-json-command.ts:16 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d5c194f4eade; files: src/commands/status-json-command.ts)

PR surface

Source +3, Tests 0, Docs +3. Total +6 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 0 +3
Tests 1 7 7 0
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 13 7 +6

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: An explicitly empty CLI selector silently reports usage for another scope, with limited impact confined to status diagnostics.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-05T08:53:47.464Z sha dc5ead0 :: blocked before merge. :: [P2] Allocate regression lines without raising the shared ceiling
  • reviewed 2026-11-05T11:22:08.409Z sha a60b08c :: needs maintainer review before merge. :: none

Reviewed 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.
@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

Addressed both findings on a60b08c0ded:

1. Test-lines ceiling (P2) — restored config/test-lines-baseline.txt to its committed value (6326640) and added config/test-lines-allocations/status-blank-agent.txt = 10, exactly this regression's net growth. The ratchet's allocation-credit check passes (credit 10 ≤ delta 10).

Measured numbers for the inherited debt this PR deliberately does not absorb:

# clean 21a5787fc87, no PR changes:
Test lines: 6481427; ceiling: 6481423; over by: 4; net delta: 0.
→ exit 0, "Tree is over the ceiling; this change does not add test lines."

# this PR with allocation-only layout:
Test lines: 6481437; ceiling: 6481433; over by: 4; net delta: +10.
→ the residual 4 lines predate this branch; left for scalar reconciliation by maintenance per the finding.

For completeness: CI runs check-test-lines-ratchet only when release_fast_lane == 'true' (.github/workflows/ci.yml), so this inherited shortfall does not redden any gate on this PR; it is reported here so maintenance can reconcile the scalar separately.

2. Proof-host redaction — replaced the concrete address with <remote-proof-host> in the Evidence section; commands and results are unchanged.

Code, tests, and shipped-CLI evidence are untouched by this bookkeeping-only follow-up.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 5, 2026
@obviyus

obviyus commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@obviyus

obviyus commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Built Linux CLI regression proof

Preserved @wangmiao0668000666's production fix. Frozen main ec2e9b6328d21d39d7efb4022f529bee3a444706 versus candidate production a60b08c0ded87d8278d4598a9a4119c6ba7ceee4, secretless Docker node:24.22.1, independently installed/built runtime artifacts, shipped node openclaw.mjs --profile <owned-profile> entry point. Final maintenance changes only consolidate tests, remove the allocation, and update existing CLI docs; production bytes are unchanged.

Separate explicit profiles, HOME/state/config/workspaces; exact binaries printed resolved config and agent SQLite paths under /work/runs/p193336{base,cand}v2/. No live state, credentials or running Gateway was used. Configured Gateway endpoint was an unused task-owned loopback port. Config contents remained unchanged throughout.

Observed 14 status calls per build (JSON and text, seven cases each):

Input Main Candidate
status --usage --agent "" exit 0; default usage availability report exit 1; --agent must not be blank
status --usage exit 0 same
status --usage --agent main exit 0 same
status --usage --agent worker exit 0 same
status --usage --agent missing-agent exit 1 same
status --agent "" (without usage) exit 1; --agent is only valid with --usage same
status (without usage/agent) exit 0; no usage section same

Actual successful JSON usage was {"providers":[]} after removing only its changing updatedAt; text was Usage: no provider usage available. This proves selection/rejection and availability rendering, not live quota values. Unknown-agent JSON retains Unknown agent id "missing-agent"; its existing text wrapper remains The CLI command failed. Control comparison normalizes only the task-specific profile embedded in that existing unknown-agent error, plus usage.updatedAt.

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 ~/Developer/.agents/handoffs/openclaw-bugloop/proofs/193336/: proof.mjs, compare.mjs, {base,cand}v2/{paths,results,calls,complete}.json, install/build logs and focused-check logs. No fault injection, fake provider data, or live-provider quota claim.

Focused verification: 27 tests passed across status-json-command.test.ts, status-json-runtime.test.ts, and status.usage-routing.test.ts; changed production/test typed lint, focused canonical run-tsgo.mjs test typecheck, and changed-file formatter check passed. Copying the final two-row regression to the frozen main gave exactly one failure (blank selector reaches the mocked scan instead of the guard); the existing no-usage rejection passed.

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.

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Nov 5, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 5, 2026
@obviyus
obviyus merged commit f2ddf6b into openclaw:main Nov 5, 2026
132 of 135 checks passed
@obviyus

obviyus commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Landed in f2ddf6b. Thanks @wangmiao0668000666. Status usage now rejects a blank agent instead of showing the default.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
…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]>
@wangmiao0668000666
wangmiao0668000666 deleted the fix/status-blank-agent branch November 6, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants