feat: expose durable session id match selection helpers#79970
feat: expose durable session id match selection helpers#79970100yenadmin wants to merge 409 commits intoopenclaw:mainfrom
Conversation
|
Codex review: found issues before merge. Summary Reproducibility: not applicable. as a user bug because this is a new public helper feature. For the patch finding, yes: source inspection shows a normal call sequence where Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Land a narrow, security-reviewed public selection seam after the SQLite storage boundary is settled, preserving distinct store/request key semantics and keeping companion-specific lineage models outside core. Do we have a high-confidence way to reproduce the issue? Not applicable as a user bug because this is a new public helper feature. For the patch finding, yes: source inspection shows a normal call sequence where Is this the best way to solve the issue? No. The helper direction is plausible, but this landing shape is not the best yet because it bundles the seam into a broad security-sensitive SQLite refactor and the rich result can mislabel request keys as store keys. Full review comments:
Overall correctness: patch is incorrect Security concerns:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against dd224c85603d. |
|
Architecture fit for this slice: flowchart TD
A["runId / sessionId input"] --> B["canonical session-id match selection"]
B --> C["none"]
B --> D["ambiguous"]
B --> E["selected"]
E --> F["gateway consumers"]
E --> G["plugin-sdk consumers"]
Why this slice exists:
Why it was chosen before broader lineage work:
Stack placement:
Lossless Claw connection:
|
|
Follow-up on the live review finding:
What changed:
Runtime proof is now in the PR body and shows:
This keeps the seam extraction-only while preserving the actual runtime semantics gateway callers already depend on. |
Summary
Implements the first narrow public discovery seam from the SQLite companion-fit stack.
This PR exposes the existing alias-aware session-id selection logic through a reusable public helper and adds a richer run-id resolution result that preserves ambiguity instead of collapsing everything to
string | undefined.Why this is better
This helps OpenClaw core and downstream consumers in a generic way:
sessionIdmatches now have one canonical selection policy instead of each caller guessingScope
Included:
SessionIdMatchSelectionre-export onopenclaw/plugin-sdk/session-store-runtimeresolveSessionKeySelectionForRun(...)helper in gateway coderesolveSessionKeyForRun(...)callersNot included:
#79904#79905Review Follow-up
This PR now preserves active-run semantics in the richer resolver too.
Fix:
resolveSessionKeySelectionForRun(...)now checksgetAgentRunContext(runId)?.sessionKeybefore the store scan, matching the existing behavior already preserved byresolveSessionKeyForRun(...)Why this was necessary:
{ kind: "none" }Primary follow-up files:
src/gateway/server-session-key.tssrc/gateway/server-session-key.test.tsReal Behavior Proof
Runtime proof from a direct module invocation on the PR branch:
{ "selection": { "kind": "selected", "storeSessionKey": "agent:retired:acp:run-live", "requestSessionKey": "acp:run-live" }, "direct": "agent:retired:acp:run-live" }That proof shows:
Validation
Observed locally:
2files passed,15tests passedStack placement
This PR is the narrow lineage/discovery seam in the companion-fit stack.
Related stack:
Why this is separate:
Issue
Refs openclaw/openclaw#79903.