Skip to content

fix(gateway): retain catalog runtime during session creation - #135048

Merged
steipete merged 1 commit into
mainfrom
codex/fix-session-catalog-runtime
Sep 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-session-catalog-runtime

Conversation

@steipete

@steipete steipete commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #134837. A registered session catalog selects a model/runtime pair, but sessions.create previously passed only the model into its late validation step. That step resolved the runtime again from configuration, so a valid catalog selection could fail with an error naming an unrelated configured harness.

Pass the already-normalized catalog runtime into the existing patch projection as trusted prepared context. Harness admission and thinking-level checks then validate the same pair that creation will persist. The registered catalog still owns the selection and plugin identity; public patches cannot supply this internal value. Validation remains before the transcript-header/session-row write, with existing lifecycle preparation and rollback ordering intact.

The regression cases exercise the actual create handler and session storage with a conflicting configured runtime:

Catalog runtime Previous result Repaired result
Registered CLI backend Rejected against configured harness Creates with catalog runtime, plugin owner, and model-selection lock
Enabled harness plugin Rejected against configured harness Creates without loading the plugin runtime
Disabled harness plugin Error names configured harness Rejects with guidance naming the disabled catalog harness

All three cases fail against the previous validation path. Seven focused catalog/sibling cases passed on the earlier integrated candidate, covering agent authorization, caller-key rejection, model locking, deletion, main-session reset avoidance, and catalog-based worktree naming/initial-send behavior. Those seven cases were not rerun as a separate focused suite on the final base. The source gate passes, and complete-candidate Codex autoreview is P0 scoped-clean.

A previous integrated candidate passed both create/patch suites, 236 tests. On the refreshed base, 235 passed and the unrelated worktree-title overall-timeout fixture exceeded its existing 15-second deadline. That request has no catalog target, model, or thinking patch, so it does not enter the changed runtime-selection path. One subsequent diagnostic run, with the same deadline/assertions and temporary phase observations, passed in 9.638 seconds: the expected eight-second naming timeout fired, the admitted run drained, and cleanup completed. The original failure's phase remains unknown. Diagnostic instrumentation was removed and all three source hashes restored; no timeout or assertion was weakened. The full-suite title timeout remains a named follow-up if it recurs.

node scripts/run-vitest.mjs src/gateway/server.sessions.create.test.ts src/gateway/sessions-patch.test.ts
node scripts/check-changed.mjs src/gateway/session-create-service.ts src/gateway/sessions-patch.ts src/gateway/server.sessions.create.test.ts

Production is +4/-0 and tests +129/-71 across three files. The four production lines carry one documented internal value through the canonical validator; no new resolver, early persistence, config option, protocol field, dependency, or SQLite change is introduced. The earlier UI repair and screenshots remain on #134837; this follow-up's evidence is handler/storage behavior, not installed-provider inference or browser proof. Independent review of committed head 25f141b291d32f40f3e6a40539d76285604bcaba completed with no actionable findings across priorities. Exact-head hosted checks completed with 228 successes, 107 skips, and one neutral result; native landing verification remains the final step.

The ClawSweeper review found no correctness defect. Its production-growth item is resolved by retaining the trusted create-only handoff through the existing validator described above, and its final-validation item is satisfied by the completed exact-head CI. No code changed after that review.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Sep 1, 2026
@steipete
steipete marked this pull request as ready for review September 1, 2026 09:21
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 5:28 AM ET / 09:28 UTC.

ClawSweeper review

What this changes

This PR passes a registered session catalog’s selected agent runtime into Gateway session-creation validation so the validated runtime matches the runtime stored on the new session.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No blocking correctness finding. This is a focused follow-up to the merged harness-admission repair: current main still re-resolves a catalog-selected runtime from configuration, while the PR preserves the catalog’s trusted runtime for the same validation and persists that pinned value.

Priority: P2
Reviewed head: 25f141b291d32f40f3e6a40539d76285604bcaba

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with relevant handler-level regression coverage and no concrete introduced defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply. The supplied body nevertheless describes after-fix Gateway handler and session-storage scenarios aligned with the changed projection path.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply. The supplied body nevertheless describes after-fix Gateway handler and session-storage scenarios aligned with the changed projection path.
Evidence reviewed 5 items Trusted catalog boundary: The public request contains only catalogId; the Gateway resolves it through the registered provider and passes the resulting target internally, so callers cannot supply the prepared runtime.
Current-main defect remains: Current main f212c91 passes no prepared runtime into session projection, whose runtime resolver falls back to configuration; this differs from the runtime catalog targets are documented to pin.
Canonical repair path: The proposed create path carries the already-normalized catalog runtime into the existing projection, which uses it for harness admission before applying model overrides and before session persistence.
Findings None None.
Security None None.

How this fits together

Gateway session creation resolves a registered catalog choice to a model, runtime, and owning plugin before validating and storing a locked session. The shared patch projection performs harness and thinking-level checks before the session row is written.

flowchart LR
  A[Registered session catalog] --> B[Gateway session creation]
  B --> C[Prepared model and runtime]
  C --> D[Shared session projection]
  D --> E[Harness and thinking validation]
  E --> F[Persisted locked session]
  E --> G[Actionable rejection]
Loading

Before merge

  • Resolve merge risk (P2) - Production grows by four lines, but the typed prepared value and one precedence branch are the narrow canonical handoff; no public option, second resolver, fallback, protocol field, or persistence format is added.
  • Complete next step (P2) - No repair job is needed: the submitted PR already addresses the source-proven defect, and normal exact-head validation remains the appropriate next step.
Agent review details

Security

None.

PR surface

Source +4, Tests +58. Total +62 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 4 0 +4
Tests 1 129 71 +58
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 133 71 +62

Review metrics

Metric Value Why it matters
Production versus regression coverage production +4/-0; tests +129/-71 The small production increase carries one trusted catalog fact into the existing validator, while the test rewrite covers the conflicting-runtime cases that previously escaped the original single scenario.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the catalog-selected runtime as trusted create-only context through the existing shared projection so harness admission validates exactly the runtime later pinned on the session.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the catalog-selected runtime as trusted create-only context through the existing shared projection so harness admission validates exactly the runtime later pinned on the session.

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

Yes, from source: a catalog target provides a concrete runtime, while current main’s late projection re-resolves from conflicting configuration. The added handler-level cases encode CLI, enabled-plugin, and disabled-plugin variants, although this read-only review did not execute them.

Is this the best way to solve the issue?

Yes. The runtime is already resolved at the registered catalog boundary and is later persisted as the session override, so passing that trusted fact to the existing projection is narrower and safer than adding another resolver or relaxing harness admission.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against f212c919e789.

Labels

Label changes:

  • add P2: This fixes a bounded Gateway session-creation failure for catalog-backed model selections without evidence of an active outage or released-user impact.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply. The supplied body nevertheless describes after-fix Gateway handler and session-storage scenarios aligned with the changed projection path.

Label justifications:

  • P2: This fixes a bounded Gateway session-creation failure for catalog-backed model selections without evidence of an active outage or released-user impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply. The supplied body nevertheless describes after-fix Gateway handler and session-storage scenarios aligned with the changed projection path.

Evidence

What I checked:

  • Trusted catalog boundary: The public request contains only catalogId; the Gateway resolves it through the registered provider and passes the resulting target internally, so callers cannot supply the prepared runtime. (src/gateway/server-methods/sessions-create.ts:139, 25f141b291d3)
  • Current-main defect remains: Current main f212c91 passes no prepared runtime into session projection, whose runtime resolver falls back to configuration; this differs from the runtime catalog targets are documented to pin. (src/gateway/session-create-service.ts:1111, f212c919e789)
  • Canonical repair path: The proposed create path carries the already-normalized catalog runtime into the existing projection, which uses it for harness admission before applying model overrides and before session persistence. (src/gateway/sessions-patch.ts:190, 25f141b291d3)
  • Regression coverage: The table-driven Gateway handler test exercises a valid CLI backend, an enabled cold plugin, and a disabled plugin while configuration names a conflicting runtime; it also verifies the selected session is locked and deletable. (src/gateway/server.sessions.create.test.ts:4034, 25f141b291d3)
  • Related merged provenance: The nearby harness-admission behavior was merged in the related PR; its merge commit precedes this follow-up and is not contained in a local release tag, so this remains an unshipped current-main follow-up. (src/gateway/sessions-patch.ts:517, 2e3cae2ae352)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete
steipete merged commit d66f597 into main Sep 1, 2026
344 checks passed
@steipete
steipete deleted the codex/fix-session-catalog-runtime branch September 1, 2026 09:36
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant