Repository navigation
fix(gateway): keep patch-created sessions visible to their creator - #128774
Conversation
…sions The sessions.patch create path skipped createdVia and createdActor, making the creator own session invisible under createSessionListEntryFilter when gateway.roles sets sessions.others=none. Thread resolveOperatorSessionCreation through sessions-patch-engine into projectSessionsPatchEntry and stamp only genuinely new rows, mirroring session-create-service. Preserve existing rows and placeholder aliases without restamping their provenance. Add an owner-boundary regression proving the identified creator can see and update a patch-created session. Follow-up of #128548.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 11:20 AM ET / 15:20 UTC. ClawSweeper reviewWhat this changesThis PR records the authenticated operator as creator when Merge readinessPatch is correct and still necessary: current main creates missing Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe Gateway turns authenticated session mutations into persisted session entries. Later Gateway read and mutation paths filter those entries by their recorded creator when a role hides other users’ sessions. flowchart LR
A[Authenticated operator] --> B[Gateway patch request]
B --> C[Session patch projection]
C --> D[Creator provenance]
D --> E[Stored session entry]
E --> F[Role visibility filter]
F --> G[Read and update access]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +4, Tests +64. Total +68 across 3 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the small producer-side repair after exact-head CI, retaining the write-once rule that stamps only genuinely new rows and never rewrites existing or placeholder provenance. Do we have a high-confidence way to reproduce the issue? Yes—current main’s missing-row patch path omits Is this the best way to solve the issue? Yes—the repair belongs at the session-entry producer, reuses the canonical creation-stamp helper, and preserves write-once provenance on existing and placeholder rows. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 70d7fb5771f9. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…sions (openclaw#128774) The sessions.patch create path skipped createdVia and createdActor, making the creator own session invisible under createSessionListEntryFilter when gateway.roles sets sessions.others=none. Thread resolveOperatorSessionCreation through sessions-patch-engine into projectSessionsPatchEntry and stamp only genuinely new rows, mirroring session-create-service. Preserve existing rows and placeholder aliases without restamping their provenance. Add an owner-boundary regression proving the identified creator can see and update a patch-created session. Follow-up of openclaw#128548.
Related: #128548
What Problem This Solves
Fixes an issue where operators who created a session through
sessions.patchimmediately lost access to their own session on gateways that hide other users' sessions. Subsequent reads and writes incorrectly failed withSession ... was not found, including whengateway.rolessetssessions.others="none".Why This Change Was Made
Carry the authenticated operator's existing session-creation provenance through the patch mutation owner and stamp it only when
sessions.patchgenuinely creates a new session row. This matchessessions.createsemantics while preserving the original provenance of existing rows and placeholder aliases.User Impact
Operators can immediately see, read, and update sessions they create through
sessions.patchwhen session visibility is restricted. Existing sessions keep their original creation provenance.Evidence
node scripts/run-vitest.mjs src/gateway/server-methods/sessions-mutations.owner.test.ts src/gateway/sessions-patch.test.ts: 92 tests passed across both focused suites.node scripts/check-changed.mjs -- src/gateway/sessions-patch.ts src/gateway/server-methods/sessions-patch-engine.ts src/gateway/server-methods/sessions-mutations.owner.test.ts: passed.1441a462b97c799a11fdffd2d6d4a0642c19207e: https://github.com/openclaw/openclaw/actions/runs/32743692221.node scripts/run-vitest.mjs src/gateway/server-methods/sessions-mutations.owner.test.ts: 4 tests passed, with no actionable correctness or security findings.