Repository navigation
fix(doctor): preserve explicit session store agent selector - #156907
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: blocked before merge. Reviewed September 29, 2026, 3:02 AM ET / 07:02 UTC (Revision 12). ClawSweeper reviewWhat this changesDoctor now forwards explicit session-store agent selectors to the shared resolver and adds a regression test for selecting a non-default agent. Merge readiness⛔ Blocked before merge - 1 item remains This remains a useful fix: current main still drops Doctor’s explicit agent selector, while the PR restores the documented owner check. The repository user who accepted the resulting CLI compatibility change has verified maintain permission. No actionable patch defect remains. Priority: P2 Review scores
Verification
How this fits togetherDoctor receives session-store paths and agent selectors from the CLI before inspecting or maintaining session SQLite data. A shared resolver identifies the store owner and returns a target or an ownership error. flowchart LR
A[Doctor CLI options] --> B[Doctor target selection]
B --> C[Shared store resolver]
C --> D{Owner matches?}
D -->|Yes| E[Selected session database]
D -->|No| F[Ownership error]
E --> G[Inspect or maintain sessions]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +4, Tests +22. Total +26 across 2 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep Doctor’s inspection and maintenance paths on the shared store-owner check, with a clear error for mismatched selectors. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source drops the selector, and the PR records before-and-after Doctor CLI results for a mismatched store owner; I did not execute the CLI in this read-only review. Is this the best way to solve the issue? Yes. Forwarding the existing selectors lets the shared resolver enforce its documented owner check without a second policy or stored-data change. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ab26b89a6aa1. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review Added exact-head real CLI proof to the PR body for #156907. It covers explicit non-default agent import, restore, canonical inspect, and the owner-mismatch control, with exit codes and redacted outputs; the focused regression is 1/1 passed. No credentials or private paths are included. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review The prior exact-review worker failed before publishing an artifact; the exact-head CLI evidence and focused-test timing remain in the PR body. Please retry the review queue. |
|
🦞👀 Re-review progress:
|
Remaining Doctor upgrade gate: exact-head isolated execution startedThe accepted explicit-agent import/restore/ownership evidence and its stated revision scope remain unchanged. To address the separate published-driver × candidate upgrade gate, a fork-only hosted run is now executing the existing repository validation against the exact reviewed head:
Observed status at this update: exact-head checkout and frozen dependency installation passed; candidate build is in progress. The package and published-upgrade stages have not completed. No upgrade PASS or merge-readiness change is claimed, and this execution record does not replace the previously accepted functional proof. |
c3385ba to
6daa40e
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…cit-agent-20260924
|
Maintainer decision from Ayaan (2026-09-29): accepted the CLI compatibility change requested in #156907 (comment). Mismatched explicit store/agent pairs now exit with an ownership error, as the documented expected-owner contract requires; matching pairs remain unchanged. The PR body now records this acceptance. No code or head change. |
|
Maintainer landing on exact head Review. The ClawSweeper review (revision 12) has no findings and accepts the proof. It is blocked only by:
Inherited failure (AGENTS.md: pre-existing reds do not block landing). Run 36532549339 finished with no cancelled jobs, and its only failing job is outside this diff (two Doctor session-SQLite files). Proof. The real Doctor CLI run on state from the published release: a mismatched selector exits 2 before inspecting anything, while a matching selector inspects the existing entry with integrity OK. Schema versions and hashes are unchanged. 509 scoped tests pass with this PR and 508 on main, with no new failures. |
|
Thanks @Alix-007 for the report and fix! Landed as 8a04eb6. The real Doctor CLI comparison on published-release operator state confirmed that mismatched explicit store/agent pairs now exit with an ownership error (exit 2), while a matching selector still returns the existing session with integrity OK. Recorded schema versions and hashes remained unchanged. |
…#156907) * fix(auth): reject empty environment credentials * fix(doctor): preserve explicit session store agent selector * test(doctor): use lifecycle-owned temp directory for agent selector --------- Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: Doctor silently accepts a different session-store owner when an explicit store path and an expected agent selector are supplied together.
User Impact
Doctor honors the expected owner for an explicit session store. Matching selectors keep working; an owner mismatch is rejected rather than inspecting another agent's store. No options, defaults, schemas, or permissions are added.
Maintainer decision (Ayaan, September 29): accepted the CLI compatibility change. Existing scripts that pass a store belonging to a different agent now exit with an ownership error; use the matching expected owner. This resolves the compatibility decision requested in the exact-head review.
Why This Change Was Made
Forward the existing
agentandallAgentsoptions to the existing session-store resolver instead of dropping them in Doctor's explicit-store branch. The shared resolver remains the single owner of selector conflicts and ownership checks.Thanks to @Alix-007 for reporting and contributing this fix, including the clawtributors report. No overlap with Pash/Sarah changes was found in the two changed files.
Caller compatibility and update behavior
The documented contract is an expected database owner, not an ownership override: Doctor SQLite selectors. A mismatch must reject. Silently using another owner is the bug being corrected.
--session-sqlite-storeplus--session-sqlite-agent(register.maintenance.ts,doctor.ts)otherstore can be inspected despite requestingmain.othersucceeds, requestingmainrejects.resolveExplicitSessionSqliteMaintenancePathsindoctor.ts)doctor-session-sqlite.ts)session-store-targets.ts,sessions*.ts,cleanup-service.ts)update-command-package.ts) and candidate canaryscripts/e2e/lib/upgrade-survivor/run.sh,run_project_worktree_import)--session-sqlite-agent main.No shipped caller was found relying on a mismatched pair. Ordinary update discovery is unchanged. This patch introduces no migration: it repairs selection before the existing data operations, preserving existing ownership refusal rather than adding a new policy.
Evidence
Observed on September 29 with the published npm
[email protected]binary (eb377ac), baselineb578706c394ebf6b486ce54a2817356b0bac77d8, and built candidate6daa40edfbd49519d8e5f78f42e30f2442826eb3:other;agents list --jsonconfirmed existingmainandother. Published Doctor imported a synthetic existing session into the canonicalotherdatabase, reporting one imported entry and no issues.--profile p156907baseor--profile p156907cand, task-owned home/state/config paths and a unique port. Before the comparison commands, each exact binary printed its resolved config and database paths; the runner checked these remained inside the isolated tree and rejected live.openclawpaths. No Gateway or external service was started.pnpm openclawafter its build, against that published operator state:--session-sqlite-agent othersucceeded on both baseline and candidate: exit 0,agentId=other, one SQLite entry, integrityok, no issues. This proves matching-selector compatibility on existing published state, not only on a freshly created candidate fixture.PRAGMA user_versionstayed 18 for shared state and 23 for both inspected agent databases. Sortedsqlite_schemadefinitions had identical SHA-256 hashes before and after candidate Doctor: shared state01688835cfc2401f2a79b4ed07490e03b945a323b325e2045bba3a3e456b5adb; agent schemaf858712016891962a11c50c0bbd8fb314f26571f1bed278306ae998b9242599d. The published binary could still inspect the same session afterward, with integrityokand no issues.This is published-state-to-candidate Doctor upgrade compatibility proof. It does not claim a full package replacement, service restart, or rollback transaction. Earlier contributor receipts additionally recorded real import/restore/inspect on production-identical head
e0199b25bd6f18e699874c9f89c20b23c04812c4; later commits changed only test-fixture cleanup and commit metadata.The complete patch remains one selector-forwarding change and one focused regression (+27/-1 across two files); no additional abstraction or production change was needed.
Hosted checks
The existing September 26 run 36240560027 is red:
checks-node-changed-compact-large-43failed update-cli fresh-doctor, post-core-recovery, restart-sentinel, and Windows-recovery cases;openclaw/ci-gateis a derived failure. Twelve other jobs were cancelled, not independent test failures. No job was rerun and no empty commit was pushed. This run is retained as historical evidence, not a new green claim.Focused candidate regression:
node scripts/run-vitest.mjs src/commands/doctor-session-sqlite.explicit-agent.test.ts --maxWorkers=1passed 1/1 through the registered unit-fast suite. Test body: 3 ms; Vitest: 44.93 s; total wall including cold worker preparation: 54.289 s. All inheritedOPENCLAW_*variables were cleared for the test process. The earlier explicitly selected commands-suite invocation found no tests because this test is routed to unit-fast; it is not counted as a test pass.Current-main integration and failure controls
Integrated main
d812797ec244into the contributor branch as7dfbe98f29fed2047f370e033bd4652253c44169, preserving all contributor commits. The named material base risk was the five-day-old base plus Doctor/update behavior, not a desire to rerun CI. The PR delta against integrated main remains exactly the two files above.Ran the current update/Doctor comparison locally with inherited
OPENCLAW_*variables removed and--maxWorkers=2:update-cli.fresh-doctor.test.ts,update-cli.target-schema.test.ts,update-cli.windows-lifecycle.test.ts,update-cli.post-core-handoff.test.ts,update-command-post-core.test.ts,update-command-post-core-failure.test.ts, and alldoctor-session-sqlite*.test.tsfiles.target-schema; the old Windows recovery assertions survive inwindows-lifecycleand use mocked Windows platform state, so they ran successfully on macOS. This is not a native Windows service proof. Current post-core owner/handoff suites cover that refactored path; removed historical cases are not represented as rerun verbatim.pnpm openclawmismatch/matching comparison on integrated head7dfbe98f29fed2047f370e033bd4652253c44169, using the same published operator state: mismatch rejected with exit 2; matchingotherreturned one entry, integrityok, and no issues. Shared/agent versions and all recorded schema hashes remained identical.