Skip to content

refactor: route gateway sessions through session seam#89120

Closed
jalehman wants to merge 2 commits into
clawdbot-9c3/session-accessor-seamfrom
clawdbot-ce2/31b-gateway-entry-seam
Closed

refactor: route gateway sessions through session seam#89120
jalehman wants to merge 2 commits into
clawdbot-9c3/session-accessor-seamfrom
clawdbot-ce2/31b-gateway-entry-seam

Conversation

@jalehman

@jalehman jalehman commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

What

Path 3 / PR 3.1b gateway entry moves gateway session entry/list read callers onto the 3.1a session accessor seam while keeping the current file-backed behavior. This covers the gateway combined-store loader, single-entry row lookup, sessions.describe, sessions.get, and key-based sessions.resolve canonicalization. Tracker: #88838.

Why

This branch-by-abstraction slice reduces direct gateway dependence on file-store reads before the SQLite storage flip. It keeps accessor return shapes storage-agnostic and intentionally does not add SQLite schema/store modules, runtime dual-read/fallback, or any storage flip.

Changes

  • Route gateway combined-store loading through listSessionEntries
  • Route gateway lookup stores through accessor reads
  • Move describe/get reads to target-with-store seam
  • Move resolve key canonicalization to same seam
  • Preserve existing file-backed legacy-key migration behavior

Testing

  • File-backed proof on source branch clawdbot-ce2/31b-gateway-entry-seam, commits 42952f53a3 and 2dfcbbbd99 (2dfcbbbd99 is the current final source commit; earlier e0e03ee6b5 was superseded by rebasing onto the current 3.1a base).
  • Disposable SQLite-loop validation: integration/sqlite-flip-gateway-entry at 63fb7f6261.
  • pnpm exec oxfmt --check src/gateway/server-methods/sessions.ts src/gateway/sessions-resolve.ts src/gateway/sessions-resolve.test.ts src/gateway/session-utils.ts src/config/sessions/combined-store-gateway.ts src/config/sessions/session-accessor.ts src/config/sessions/session-accessor.test.ts
  • node scripts/run-vitest.mjs src/gateway/sessions-resolve.test.ts src/gateway/server.sessions.create.test.ts src/gateway/server.sessions.preview-resolve.test.ts src/gateway/session-utils.test.ts src/gateway/session-utils.search.test.ts src/gateway/session-utils.subagent.test.ts src/gateway/session-utils.single-row-cache.test.ts src/config/sessions/session-accessor.test.ts passed: 186 tests.
  • node scripts/run-oxlint.mjs src/gateway/server-methods/sessions.ts src/gateway/sessions-resolve.ts src/gateway/sessions-resolve.test.ts src/gateway/session-utils.ts src/config/sessions/combined-store-gateway.ts src/config/sessions/session-accessor.ts src/config/sessions/session-accessor.test.ts
  • git diff --check
  • rg "loadSessionStore" src/gateway/server-methods/sessions.ts src/gateway/sessions-resolve.ts returned no matches.
  • Autoreview reported no accepted/actionable findings.

Blockers: none. Next dependency: base branch clawdbot-9c3/session-accessor-seam / PR #88840.

@clawsweeper

clawsweeper Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 4, 2026, 4:42 PM ET / 20:42 UTC.

Summary
The PR routes gateway session listing, lookup, describe/get, and key-resolution reads through the session accessor seam while preserving file-backed behavior.

PR surface: Source +35, Tests -2. Total +33 across 5 files.

Reproducibility: not applicable. this is a refactor PR, not a bug report with a failing current-main reproduction path. The review evidence is source/diff inspection plus the contributor's listed focused validation.

Review metrics: 1 noteworthy metric.

  • Stack dependency: 1 open base PR. The branch targets the accessor-seam base instead of main, so maintainer review needs to settle that seam before this dependent gateway slice can safely land.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted real gateway runtime output or a linked artifact showing sessions.describe, sessions.get, or sessions.resolve after this patch.
  • Resolve or explicitly approve the base accessor-seam dependency before requesting merge review.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body lists tests, lint, formatting, and branch validation, but no redacted terminal/log output, recording, or linked artifact showing an affected gateway RPC after the patch. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The PR is stacked on the still-open base accessor-seam PR at refactor: add session accessor seam #88840, so merging this slice first could lock in a session seam shape maintainers may still change.
  • [P1] The diff rewires gateway session listing, lookup, describe/get, and resolve paths; a seam regression here could hide, stale, or mis-associate session rows.
  • [P1] Contributor validation is focused tests/lint/format plus branch notes, with no redacted real gateway runtime output or linked artifact showing an affected RPC after the patch.

Maintainer options:

  1. Review after the base seam settles (recommended)
    Accept or revise the accessor-seam base before treating this dependent gateway slice as merge-ready.
  2. Require gateway runtime proof
    Ask for redacted terminal/log output or a linked artifact showing sessions.describe, sessions.get, or sessions.resolve after this patch.
  3. Pause if the seam direction changes
    If maintainers change the base seam contract, pause this branch and ask for a narrow replacement against the accepted interface.

Next step before merge

  • [P1] Protected maintainer-labeled, draft, stacked session-state work needs maintainer review and contributor proof rather than automated repair or cleanup close.

Security
Cleared: No concrete security or supply-chain concern was found; the diff is limited to internal gateway/session read routing and a focused test update.

Review details

Best possible solution:

Keep the PR open for maintainer review, settle the base accessor seam first, then require redacted real gateway runtime proof for an affected session RPC before merge.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this is a refactor PR, not a bug report with a failing current-main reproduction path. The review evidence is source/diff inspection plus the contributor's listed focused validation.

Is this the best way to solve the issue?

Unclear until maintainer review of the base seam is complete. The slice is a plausible narrow step for the Path 3 migration, but it should not be treated as the best final path until #88840 is accepted or revised.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against d5ce1edf7e79.

Label changes

Label justifications:

  • P2: This is a normal-priority internal session-state migration slice with limited immediate user impact but meaningful gateway-session correctness risk.
  • merge-risk: 🚨 session-state: The diff changes gateway session row lookup and resolution paths where a seam regression could hide, stale, or mis-associate sessions.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body lists tests, lint, formatting, and branch validation, but no redacted terminal/log output, recording, or linked artifact showing an affected gateway RPC after the patch. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +35, Tests -2. Total +33 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 4 63 28 +35
Tests 1 24 26 -2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 87 54 +33

What I checked:

  • Repository review policy applied: Root policy requires full AGENTS.md review, whole-surface PR review, session-state compatibility caution, and real behavior proof for user-visible review confidence; scoped gateway policy was also read. (AGENTS.md:28, d5ce1edf7e79)
  • Scoped gateway policy applied: The gateway scoped guide emphasizes hot-path discipline and focused gateway test verification for gateway server changes. (src/gateway/AGENTS.md:1, d5ce1edf7e79)
  • Current main behavior: Current main still resolves key-based gateway session reads by resolving the target then loading the session store directly, which is the behavior this PR is moving behind the seam. (src/gateway/sessions-resolve.ts:121, d5ce1edf7e79)
  • Proposed gateway handler surface: The PR head adds loadSessionEntriesForTarget and uses it for sessions.describe and sessions.get, so the changed runtime surface is gateway session row/message reads. (src/gateway/server-methods/sessions.ts:261, 9aecae2c459d)
  • Proposed resolve seam use: The PR head uses resolveGatewaySessionStoreTargetWithStore({ clone: false }) for key resolution and refreshes the seam after legacy-key migration. (src/gateway/sessions-resolve.ts:120, 9aecae2c459d)
  • Base seam contract: The stacked base accessor seam exposes listSessionEntries, which currently delegates to the file-backed store and preserves clone behavior; this PR depends on that open seam shape. (src/config/sessions/session-accessor.ts:136, b39023fc3ca4)

Likely related people:

  • Peter Steinberger: Local blame on the current-main gateway/session lookup and combined-store functions points to recent work in the touched area. (role: recent area contributor; confidence: medium; commits: f8f7ba8f0178; files: src/gateway/session-utils.ts, src/gateway/sessions-resolve.ts, src/config/sessions/combined-store-gateway.ts)
  • jalehman: The provided PR context shows this contributor authored the current gateway seam slice and the related session-accessor migration tracker/base stack, so they are a likely follow-up owner for this branch even though current-main ownership is separate. (role: migration stack author; confidence: medium; commits: 897eb03e29c3, 9aecae2c459d, b39023fc3ca4; files: src/gateway/server-methods/sessions.ts, src/gateway/sessions-resolve.ts, src/gateway/session-utils.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jun 1, 2026
@jalehman
jalehman marked this pull request as draft June 1, 2026 18:10
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jun 1, 2026
@jalehman
jalehman force-pushed the clawdbot-9c3/session-accessor-seam branch from f18f99c to b39023f Compare June 4, 2026 20:31
@jalehman

jalehman commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #90463, which combines this gateway consumer with the underlying session accessor seam from #88840. Keeping them together makes the seam production-reachable for CI while preserving the same functional gateway slice.

@jalehman jalehman closed this Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant