Repository navigation
fix: session creation fails through directory aliases - #158401
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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 25, 2026, 9:52 PM ET / September 26, 2026, 01:52 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch makes session creation use SQLite’s admitted database path for creation ownership and publication, and adds alias and stale-owner regression tests. Regression provenancePossible regression — suspected (failure trace). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Current main still has the reported directory-alias failure, and no merged fix supersedes this PR. The focused repair appears correct; this review found no actionable patch defect. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway prepares a session from a SQLite read snapshot, then a worker commits its transcript and session row. Publication updates the prepared facts used by subsequent session operations. flowchart LR
A[Session creation request] --> B[SQLite read worker]
B --> C[Admitted path and identity]
C --> D{Creation owner current?}
D -- Yes --> E[Session write worker]
E --> F[Publish row and sharing facts]
F --> G[Session available]
D -- No --> H[Reject stale creation]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +3, Tests +106. Total +109 across 5 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the admitted SQLite path for creation custody and its publication event while preserving live checks against the caller’s original locator. Do we have a high-confidence way to reproduce the issue? Yes, from source and the supplied pre-fix Gateway result: an aliased store locator differs from SQLite’s admitted filename and reaches the exact creation-owner rejection. This read-only review did not execute the flow. Is this the best way to solve the issue? Yes. Reusing the filename captured by SQLite admission is a narrow repair, and the original locator still controls identity and revocation checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against da49c7e45c4c. 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 (2 earlier review cycles)
|
b3c31ec to
c04d502
Compare
Related: #155800
What Problem This Solves
Fixes session creation failing with
Session creation publication owner is no longer currentwhen the session database is reached through a directory alias, including macOS/tmp→/private/tmp.User Impact
Sessions can finish asynchronous preparation, commit, and publication through an aliased database path while replaced, closed, and completed owners still reject. No configuration, schema, protocol, migration, or operator action changes.
The retained full live run on original head
b3c31ec49720was not green: 79 passed, 27 failed, 12 skipped. The targeted publication-owner failure disappeared from all 25 affected scenarios and the cumulative 118-scenario run. Residual failures and attribution limits are recorded below, separately from the rebased head’s successful CI.Why This Change Was Made
The creation operation was still active and held the correct database identity, agent, and session key. Its source path used the caller's lexical locator, while prepared sharing facts selected SQLite's admitted filename. The exact-owner guard correctly rejected that mismatch. Publishing the subsequent header change under the lexical locator also invalidated the prepared facts.
Carry the already admitted filename through the existing worker snapshot, bind the creation owner to it, and reuse the existing active-creation custody predicate to publish its changes under that same path. Keep the original locator for writer-backend custody, file-identity validation, and reader revocation. Reopening the writer through another alias would compete with its existing backend owner.
This removes the lexical-path creation binding/publication paths. Ordinary non-creation publications retain their existing locator contract. The guard, stale-owner rejection, and receipt rules remain intact; no retries, timeouts, consumer guards, alternate owners, filesystem probes, QA special cases, or source-default overrides were added.
Production: +15/−12, net +3 lines across four files. Tests: +109/−3, net +106 lines in one existing suite. The publication refactor absorbs the custody predicate with zero net growth; three lines carry the missing admitted fact through the existing type/producer/consumer, avoiding a second path-resolution owner.
Evidence
Requested rebase
Rebased without conflicts onto
5be36d37cb73a4f9ddf23ed9ab4fe51a3797e25c, producing current headc04d502b8ba2862254b23e8318ea96549fa1aaad. Force-with-lease push verified. Range-diff preserves every repair hunk and test, including upstream’s new session-entry publication scope. No manual source/test changes or added commit were needed; LOC remains unchanged. All 11 retained summary/report/bisect files match their pre-rebase checksums.Proportional current-head proof: all 10 focused owner/lifecycle/discovery/diagnostic test files passed across two sequential Vitest shards in 152.09s. The normal isolated mock
runtime-tool-execpassed (1/1, 13.482s), exercising publicsessions.createwith two explicit non-main keys, tool-inventory reads, and subsequent turns. Its mock exec plans are diagnostic-only. Native QA cleanup completed and the separate CLI state root was removed. Sibling Codex’s exact-instance lifecycle contract was personally rechecked before the rebase verdict.Exact-head CI passed: run 36209513075 completed with 127 successful jobs, 19 skipped, zero failures, including
openclaw/ci-gate. All other exact-head workflows completed successfully or skipped; required aggregate CI/security checks passed. CI attached automatically to the Ready PR. No reruns, duplicate dispatch, repair commit, or additional re-review mention were needed.Exact-head review: the automatic ClawSweeper review completed at 2026-09-26 01:52 UTC and pins
c04d502b8ba2: Ready for maintainer review, no findings, security concerns, before-merge items, or requested rank-up work. The durable review link below now shows this current-head review. No actionable items or justified skips were needed.Local check attribution: production types and all 25 core-test type graphs passed, as did formatting, ratchets, exports, dependency and boundary guards. The native changed-check command stopped at
eslint(max-lines)insession-accessor.sqlite-entry-cache-publication.ts: 701 counted lines against 700. The unmodified file from base5be36d37cb73areproduces the identical 701-line failure under the same rule; this branch has zero net line growth in that file. This is a proven pre-existing base violation, left unchanged. All eight remaining storage/schema, media, sidecar, cycle, webhook, and auth checks passed when run separately after that stop. The local aggregate is not claimed green.The affected-25 and full-118 results below are retained historical proof on
b3c31ec497206236f9813e9416b935cb8ee243fe; those live campaigns were not rerun for this patch-preserving rebase.Original behavioral proof
4368865c48b5f86b3274350c76d5349b95381261. Tested behavioral head:b3c31ec497206236f9813e9416b935cb8ee243fe.runtime-tool-exec, normalmock-openai, isolated state/profile/Gateway: 0 passed, 1 failed with the exact guard error before model execution (15.162s).0963fd5da97c12028b4df78c4515f1286b0cc835, rejects ated81a70423faf3de9fb5fbda7a08f25831cdcb20, and rejects at frozen current main. This is historical boundary proof, not three historical full-Gateway runs. Shared-auth Doctor relocation predates the campaign baseline; it is not established as the cause.runtime-tool-execpassed.pnpm test src/config/sessions/session-accessor.sqlite-creation-worker.test.ts --maxWorkers=1: 41.27s wall / 38.91s Vitest, including cold compiler refresh. Aliased positive case 3.16s; replacement/closure cases 0.82s/0.85s. Original-head Linux CI: all 13 passed; 32.16s summed reported test execution (excluding import/setup overhead), with 5.43s positive and 1.38s/1.31s stale controls. This existing worker suite exercises real SQLite admission, retained sharing facts, and publication that a cheaper mocked layer would bypass. No sleeps, polling, extra Gateway boots, or committed worker pinning.b3c31ec49720was pushed. Its review said Ready for maintainer review with no actionable items. The durable public review now contains the automatic review of rebased headc04d502b8ba2, described above.b3c31ec49720: 79 passed, 27 failed, 12 skipped, zero publication-owner errors. Default selection matches the previous 118 scenario titles; no model/runtime/fast overrides. Previous cumulative run: 75 passed, 43 failed.Full-suite residual failures and attribution limits
Three scenarios passed in the retained previous run and failed here. Their cause is unresolved, not claimed unrelated or fixed: sender-scoped subagent tool inheritance returned a generic processing error; model-switch tool continuity missed kickoff continuity; heartbeat expected an existing config-owned monitor. Available scenario artifacts establish these assertions, not a branch-attributable root cause. No rerun or broader repair was used to turn them green.
The other 24 failing scenario titles also failed previously, although that alone does not prove identical causes:
openclaw-appselector timed out after 360s, before text/image roundtrip; previous failure was later in the image roundtripchat.historyread; controlled proof reproduces before the introducing commit, with and without an aliasA background
SQLite database already belongs to another worker backenddiagnostic is independently reported on unmodified main in PR #158120. This is corroborating baseline evidence, not a claim that every residual has that cause.The cron attribution was traced separately after the cumulative run. Two isolated diagnostic runs captured the failing stack and its triggering first-row
facts.kind=entrypublication from the native entry writer. No creation operation is bound to that history read. A controlled real-writer harness then reproduced the same rejection on both0963fd5da97c12028b4df78c4515f1286b0cc835and original candidateb3c31ec49720, with canonical and aliased paths; fresh post-commit reads succeed in all four cells. History reports the invalidation as a retryableUNAVAILABLEresponse. This is distinct from the repaired creation-owner path mismatch. The task owner explicitly retained the one-root scope after reviewing this evidence; no history guard, retry handling, or QA assertion was changed.Original-head CI residuals (b3c31ec)
Native
scripts/pr ci-dispatchattached run 36197512406 to original headb3c31ec49720because ordinary draft PR checks are skipped. No check, runner, or source-default override was added.Completed: 203 successful jobs, 12 skipped, three failed test jobs plus the failed aggregate
openclaw/ci-gate. The run is not green. The changed creation-owner suite, config/session job, Gateway-method job, and changed checks passed. No failure attributable to this branch was found; the three residuals below remain visible for maintainers.gateway-cron-process-identity.windows.test.tstimed out waiting for Gateway readiness after 60 seconds. Logs show slow startup/checkpoint/schema SQLite work. The test fails ininstance.startGateway(), before connecting or creating its cron job/session; this does not exercise the repaired creation boundary. The underlying Windows startup delay is unresolved.mobile-pairing.e2e.test.ts:481timed out reopening the Pair a device dialog. This test installs a mocked Gateway and does not execute the changed SQLite owner code. The UI timeout remains unresolved.subagent-registry.test.ts:798, “retries a terminal completion deferred by restart drain,” expected its mocked announcement once but saw zero calls. This test mocks the session accessor, Gateway calls, and announcements; the failing restart-drain scheduling path does not create a session through the changed owner. Its scheduling failure remains unresolved; 1,934 sibling tests passed.These original-run failures were inspected and classified without CI reruns or unrelated changes. The later explicit rebase request and its fresh CI result are recorded above.
Personally inspected sibling Codex contract and retained evidence
Sibling Codex at
39598ed17885970828acd42a6370131ed0190a98was personally inspected before the implementation/verdict:codex-rs/app-server-protocol/src/protocol/v2/thread.rs:48–130,188–225: thread/start parameters and response.codex-rs/app-server/src/request_processors/thread_processor.rs:1125–1185,1313–1405,1470–1520: awaited preparation/start and failed-start metadata cleanup.codex-rs/core/src/thread_manager.rs:2280–2365: await spawn and SessionConfigured, insert the exact thread instance, then notify readiness;:1349–1367checksArc::ptr_eqbefore removing the expected instance.These contracts preserve exact-instance custody across async preparation. No Codex adapter/protocol change is needed for this pre-model OpenClaw failure.
Local evidence root:
.artifacts/qa-e2e/session-publication-owner/in the task checkout. Retained reproduction/introduction evidence:pre-fix/qa-suite-summary.json,pre-fix/qa-suite-report.md,bisect.log. Requested cumulative artifacts:affected-25-b3c31ec49720/qa-suite-summary.jsonandqa-suite-report.mdfull-118-b3c31ec49720/qa-suite-summary.jsonandqa-suite-report.mdrebase-c04d502b8ba2-mock/qa-suite-summary.jsonandqa-suite-report.mdRaw runtime logs, prompts, credentials, and agent transcripts are not published. Current GitHub searches found no suitable existing fix to reuse.
This PR is for maintainer review only; no merge, queue, or automerge is requested.