Repository navigation
fix(agents): import identity from literal source paths - #186475
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 leading and trailing whitespace in nonblank identity-file and workspace source paths. Example: Run agents set-identity --agent main --identity-file "/tmp/identity.md " when both neighboring files exist.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a concrete wrong-source identity import still present on current main; the focused implementation has no actionable findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe CLI identity command resolves an operator-selected source, reads identity fields, and updates the selected agent through the existing config mutation owner. flowchart LR
A[CLI source flags] --> B[Nonblank validation]
B --> C[Literal path and home expansion]
C --> D[Identity file reader]
D --> E[Agent config mutation]
E --> F[Saved config and CLI output]
Technical reviewBest possible solution: Merge the focused selector fix through the existing identity command and config writer. Do we have a high-confidence way to reproduce the issue? Current-main source shows both trimming layers, and obviyus supplies repeated built-CLI wrong-neighbor reproductions against the pinned baseline; no target code was executed during this review. Is this the best way to solve the issue? The patch is the smallest complete fix: preserve nonblank selector bytes at validation and resolution while retaining home expansion, blank rejection, identity parsing, and the existing write owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 24103c1da10c. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +4, Tests +34, Docs +1. Total +39 across 3 files. Added test files: 0. View PR surface stats
Review metrics
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 HistoryReview history (1 earlier review cycle)
Reviewed October 28, 2026, 12:33 AM ET / 04:33 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Current-head built CLI proof on Linux arm64, Node v24.22.1. Baseline main: Commands used the built entry point, isolated profile/HOME/state/config, and independent saved-config readback: Each successful import left the configured workspace unchanged. Ordinary absolute and relative files, home expansion, a symlink, and ordinary workspace imports passed on both refs. Blank and missing file/workspace selectors exited 1 with byte-identical config. Focused tests: 21 passed on candidate; the same two new literal-source cases fail on main by selecting the wrong neighbor. Focused formatting/lint and whitespace checks passed. No Gateway, model credential, schema change, or global decoder change was involved. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks @obviyus for reviewing this and running the extra verification! |
fix(agents): import identity from literal source paths `openclaw agents set-identity` trimmed the file and workspace source selectors, so a selector whose path starts or ends with whitespace resolved to a different, neighboring path and imported the wrong identity. Selectors are now used as written; blank and missing selectors behave as before. Evidence: built CLI on Linux with identity files named so that trimming selects the neighbor. On main leading and trailing file and workspace selectors imported the wrong identity (twice); with this change they imported the exact one (twice). Ordinary, relative, home, blank and missing selectors behave the same on both refs. Production 14 lines. Thanks @Alix-007. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
agents set-identitytrims nonblank--identity-fileand--workspacesource selectors. On filesystems supporting leading or trailing spaces, that can import the identity from a different, neighboring path and save the wrong agent identity.User Impact
Quoted source paths select the exact file or directory. Empty or whitespace-only selectors still fail, and importing from another directory does not relocate the configured workspace.
Why This Change Was Made
Use existing nonblank-string validation and home-prefix expansion in this command's local resolver without trimming valid filename bytes. Global path decoding, identity parsing, scalar identity fields, config schema, and the config writer remain unchanged.
Evidence
Observed runtime capture.
Built CLI on Linux arm64, Node 24.22.1, with isolated task-owned HOME, profile, state and config. Each case independently reads the saved JSON config after
agents set-identity --agent main ... --json.~/home-expanded, symlink, and ordinary workspace controls.git diff --checkpassed.Simplification: reuse the existing command owner and helpers; no new abstraction or global decoder change. Production +9/-5, regression tests +34, docs +1; no test baseline raised.
Two-way door: reverting restores path trimming; no migration or new stored format. It cannot automatically undo identities previously imported from a wrong source. Blast radius is source-path selection for
agents set-identity, not agent routing or other path consumers.