Repository navigation
fix(templates): empty agent overrides silently select a default - #192934
Conversation
|
🦞👀 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 changesPreserve explicitly empty agent-ID overrides so Templates Add and dev reject them through existing planner validation. Example: Run templates add PROJECT --dry-run --agent-id "" with proof-agent and proof-agent-2 already configured.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current Templates CLI bug with a focused change; no actionable defects were found, and ordinary CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherTemplates CLI adapters pass package content, destination overrides, and configured resource identities to the shared Add planner, which returns diagnostics and actions before installation. flowchart TD
A[Templates CLI input] --> B[Add adapter]
A --> C[Dev adapter]
B --> D[Shared Add planner]
C --> D
D --> E[Existing portable ID validator]
E --> F[Blocked preview or valid plan]
Technical reviewBest possible solution: Land the existing adapter forwarding and nullish planner defaulting after required CI completes. Do we have a high-confidence way to reproduce the issue? Current-main source discards empty overrides in both adapters and the planner; the supplied built-CLI comparison independently demonstrates the resulting automatic selection. Is this the best way to solve the issue? This is the smallest complete fix: preserve caller input at both adapters and let the existing planner validator distinguish invalid emptiness from omission. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against aedae9dc4102. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests 0, Docs +3. Total +3 across 6 files. Added test files: 0. View PR surface stats
LabelsLabel 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 HistoryReview history (1 earlier review cycle)
Reviewed November 4, 2026, 2:40 PM ET / 19:40 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Built public CLI: empty overrides rejected, automatic numbering preservedExact PR head: The fixture creates a synthetic project through the real For EACH ref, the public commands are exercised with an empty flag, omitted flag, and valid chosen-agent override: The controls replace the empty flag with omission or Main silently returns Actual output/readback fields from all twelve cases: [
{
"lane": "base",
"case": "dev-empty",
"exit": 0,
"finalId": "proof-agent-3",
"blockerCodes": [],
"configUnchanged": true,
"destinationWorkspaceExists": false,
"previewOnly": true
},
{
"lane": "base",
"case": "dev-omitted",
"exit": 0,
"finalId": "proof-agent-3",
"blockerCodes": [],
"configUnchanged": true,
"destinationWorkspaceExists": false,
"previewOnly": true
},
{
"lane": "base",
"case": "dev-valid",
"exit": 0,
"finalId": "chosen-agent",
"blockerCodes": [],
"configUnchanged": true,
"destinationWorkspaceExists": false,
"previewOnly": true
},
{
"lane": "base",
"case": "add-empty",
"exit": 0,
"finalId": "proof-agent-3",
"blockerCodes": [],
"configUnchanged": true,
"destinationWorkspaceExists": false,
"previewOnly": true
},
{
"lane": "base",
"case": "add-omitted",
"exit": 0,
"finalId": "proof-agent-3",
"blockerCodes": [],
"configUnchanged": true,
"destinationWorkspaceExists": false,
"previewOnly": true
},
{
"lane": "base",
"case": "add-valid",
"exit": 0,
"finalId": "chosen-agent",
"blockerCodes": [],
"configUnchanged": true,
"destinationWorkspaceExists": false,
"previewOnly": true
},
{
"lane": "cand",
"case": "dev-empty",
"exit": 1,
"finalId": "",
"blockerCodes": [
"invalid_agent_id"
],
"configUnchanged": true,
"destinationWorkspaceExists": false,
"previewOnly": true
},
{
"lane": "cand",
"case": "dev-omitted",
"exit": 0,
"finalId": "proof-agent-3",
"blockerCodes": [],
"configUnchanged": true,
"destinationWorkspaceExists": false,
"previewOnly": true
},
{
"lane": "cand",
"case": "dev-valid",
"exit": 0,
"finalId": "chosen-agent",
"blockerCodes": [],
"configUnchanged": true,
"destinationWorkspaceExists": false,
"previewOnly": true
},
{
"lane": "cand",
"case": "add-empty",
"exit": 1,
"finalId": "",
"blockerCodes": [
"invalid_agent_id"
],
"configUnchanged": true,
"destinationWorkspaceExists": false,
"previewOnly": true
},
{
"lane": "cand",
"case": "add-omitted",
"exit": 0,
"finalId": "proof-agent-3",
"blockerCodes": [],
"configUnchanged": true,
"destinationWorkspaceExists": false,
"previewOnly": true
},
{
"lane": "cand",
"case": "add-valid",
"exit": 0,
"finalId": "chosen-agent",
"blockerCodes": [],
"configUnchanged": true,
"destinationWorkspaceExists": false,
"previewOnly": true
}
]All plans assert dryRun=true and mutationAllowed=false; dev additionally asserts offline=true. Independent filesystem observations confirm every planned destination workspace and workspace action target remains absent. Config bytes and SHA-256 are unchanged before/after every case. The generated source fixture is intentional setup, not an installed agent. This proves previews/plans only, not full Add installation or a model turn. No Gateway, provider or real credentials were used. Verification: 72 focused tests pass (both CLI suites plus schema tests). The two adapter regressions fail on main, with the other 19 CLI cases passing. The final unchanged failure-assertion cases, focused changed-test typecheck, targeted typed lint, and formatting of all six changed files pass. Whole-PR deltas: production +5/-5 (net 0, ten gross lines), tests +55/-55 (net 0), docs +3; allocation removed, no baseline increase. Contributor @zhangguiping-xydt's fix commit and credit are preserved. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 863cd7e. Thanks @zhangguiping-xydt. templates dev and add now reject an empty agent id. |
…claw#192934) fix(templates): validate empty agent ids on templates dev and add Like openclaw#192726 for `templates create`, an explicitly empty `--agent-id` on `templates dev` and `templates add` was silently ignored and an auto-numbered agent id was used. An explicit blank now reaches the existing portable-ID validator and is rejected. Omitted flags still auto-number, and valid ids are unchanged. Evidence: built CLI previews for both dev and add dry-run. Main silently selected `proof-agent-3` for empty overrides; with this change they are rejected with the existing `invalid_agent_id` error and exit 1. Omitted flags still auto-number to `proof-agent-3`, valid overrides keep `chosen-agent`, and config is unchanged. Details: openclaw#192934 (comment). Thanks @zhangguiping-xydt. Co-authored-by: Ayaan Zaidi <[email protected]>
…#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 #192726 and #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: #193336 (comment). Thanks @wangmiao0668000666. Co-authored-by: Ayaan Zaidi <[email protected]>
…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
templates devandtemplates add --agent-id ""silently discard the explicitly empty override and select an automatically numbered agent ID instead of returning the planner's existing portable-ID validation error.User Impact
An explicitly empty agent ID produces the existing
invalid_agent_idblocker and exit 1. Omitting the flag still selects the next unused template copy; a valid explicit ID remains unchanged. No new option, validator, default policy, schema, permission, or migration.Why This Change Was Made
Forward the supplied value unchanged through both CLI adapters and default only nullish IDs in
buildTemplateAddPlan. Its existing portable-ID validator owns rejection, before installation can proceed. This completes the Add/dev side of the explicit-empty defect class previously fixed for creation in #192726, while retaining the numbering behavior from #171623.Preserves @zhangguiping-xydt's original fix commit and credit. The dev regression reuses the real authoring/build/preview fixture; the Add regression shares its existing package-identity matrix. Gateway-readiness setup is consolidated while retaining immediate readiness, cached/applied revisions and deadline/error coverage. The allocation file is removed. Whole-PR deltas: production +5/-5 (net 0, ten gross changed lines), tests +55/-55 (net 0), docs +3.
Evidence
Built public CLI proof and twelve captured preview outcomes.
Both current main
ae402b4faf99178ff433094b0e9798885145c420and candidate productionbee92fa45c94f0d58fa937b16c908dab6b218a5bwere runtime-built and exercised through shippedopenclaw.mjsin secretless Node 24.22.1 Docker, with explicit owned profiles, HOME/state/config and database paths. Final head76967828d717b0258dae82fc5d2bdd6bf2bf9aa3changes only tests and allocation removal afterward.For BOTH dev and Add dry-run, existing configured IDs
proof-agentandproof-agent-2force genuine automatic selection ofproof-agent-3:--agent-id ""proof-agent-3invalid_agent_id, blocked agent actionproof-agent-3--agent-id chosen-agentchosen-agentConfiguration bytes remain unchanged after every case; all destination workspaces and workspace-action targets remain absent. All plans have dryRun=true and mutationAllowed=false; dev is offline. This is preview/planner proof only: no full Add installation, model turn, Gateway, external provider, or live credentials.
72 focused tests pass. The two adapter regressions fail on main, with 19 CLI controls passing. Focused changed-test typechecking, typed lint, the final failure-assertion cases and formatting of all six changed files pass. No test allocation or baseline increase.
Merge danger
Two-way door: reverting restores the previous empty-override defaulting. No existing agent or stored format is changed, and no migration is needed. Blast radius is explicit empty identity overrides reaching Template Add/dev planning. Omission, automatic numbering, valid overrides, installation ownership and ordinary failures remain unchanged; full Add installation was not exercised by this proof.