Skip to content

fix(agents): prevent scoped model checks from stalling the gateway - #123473

Merged
steipete merged 1 commit into
mainfrom
codex/prepared-catalog-hazards
Aug 14, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/prepared-catalog-hazards

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #120834
Related: #123368

What Problem This Solves

Fixes an issue where configured Gmail model validation, fallback-attempt thinking hydration, and sessions_spawn structured-output capability checks could materialize the full live model catalog. On source deployments, any of those narrow reads could fan out across provider plugins, block Gateway responsiveness, and add a large transient heap load.

Why This Change Was Made

The fallback attempt now reuses the provider-scoped thinking helper introduced by #120834. Gmail validation and structured-output capability checks keep live runtime-model discovery, but constrain it to the selected provider and mark the prepared-catalog read as read-only, so none of the three paths can invoke the full-catalog loader.

Production LOC: +17/-9 (net +8) | Tests: +102/-25

User Impact

Cold Gateway startup, model fallback attempts, and structured-output subagent spawns no longer risk broad provider discovery stalls from these dormant paths. Runtime-only provider models remain discoverable within the provider being checked.

Evidence

  • Before the fix, focused regressions failed independently at all three sites: Gmail called the full-catalog counter, fallback thinking threw from the full loader at run-embedded-attempt.ts:406, and structured-output spawn returned the full-loader error instead of the tool-capability verdict.
  • After the fix, the three focused remote Vitest shards passed: 242/242 tests, with every full-catalog counter remaining at zero.
  • Path-scoped changed guards passed, including formatting, dependency pins, boundaries, dead-export scan, and production typecheck.
  • pnpm check:test-types passed across core, extension, and root test typecheck shards.
  • pnpm build passed, including CLI bootstrap imports, runtime postbuild, Plugin SDK export verification, and Control UI build.
  • Codex autoreview: clean, no accepted/actionable findings.

Provenance: the fallback-attempt read came from #116584 and was missed when #120834 repaired its primary and cron siblings. The Gmail prepared-catalog call came from #111173. The structured-output capability read originated in #110932 and was carried through #114030 and #114301.

@clawsweeper

clawsweeper Bot commented Aug 14, 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 agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Aug 14, 2026
@steipete steipete self-assigned this Aug 14, 2026
@steipete
steipete merged commit c636cf5 into main Aug 14, 2026
163 checks passed
@steipete
steipete deleted the codex/prepared-catalog-hazards branch August 14, 2026 05:13
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 1:13 AM ET / 05:13 UTC.

ClawSweeper review

What this changes

Scopes Gmail startup validation, fallback thinking hydration, and structured-output spawn capability checks to the selected provider so they do not build the full live model catalog.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open. This protected maintainer PR addresses a plausible P1 gateway-availability regression, but the review runner could not read the checkout: every command failed before execution with bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted; no source, history, scoped policy, or full diff was inspected.

Priority: P1
Reviewed head: 23e29ee5c7e499dc3e9746a347408eb4776ff665
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The proposed repair has focused validation claims and no concrete diff finding from the supplied material, but the failed inspection environment prevents a higher-confidence patch rating.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository state identifies this as a protected maintainer PR; contributor real-behavior proof is not the applicable gate, although its claimed runtime validation still needs independent exact-head review.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state identifies this as a protected maintainer PR; contributor real-behavior proof is not the applicable gate, although its claimed runtime validation still needs independent exact-head review.
Evidence reviewed 3 items PR-stated regression coverage: The supplied PR body reports three focused regressions covering Gmail validation, fallback thinking hydration, and structured-output spawn checks, with full-catalog counters remaining zero after the branch change.
Related merged work: The supplied context identifies merged PR #120834 as the provider-scoped catalog helper’s originating repair and #123368 as a related cold-turn availability repair.
Inspection infrastructure failure: The required read-only checkout inspection could not begin: the sandbox rejected commands before execution with a bwrap loopback permission error, so this review does not claim source, test, history, or AGENTS.md inspection.
Findings None None.
Security None None.

How this fits together

Gateway startup and agent execution consult prepared model catalogs to validate configured models and runtime capabilities. These reads affect whether startup, fallback attempts, and subagent spawns remain responsive or trigger broad provider discovery.

flowchart LR
  Config[Configured model]
  Entry[Gateway startup or agent run]
  Check[Scoped capability check]
  Catalog[Prepared model catalog]
  Discovery[Provider discovery]
  Outcome[Startup or spawn result]
  Config --> Entry
  Entry --> Check
  Check --> Catalog
  Catalog --> Discovery
  Catalog --> Outcome
Loading

Decision needed

Question Recommendation
Should this protected maintainer PR proceed after an exact-head review confirms that all three scoped reads preserve runtime-only provider models without allowing full-catalog discovery? Complete exact-head owner review: Inspect the catalog helper, its live-discovery contract, the three callers, and their regressions before accepting the availability-sensitive change.

Why: The local review environment could not inspect the implementation, and the change affects gateway availability through a shared catalog boundary.

Before merge

  • Resolve merge risk (P1) - The branch changes provider-discovery containment on gateway and agent paths; exact-head source review is still needed to confirm the scoped live-discovery flags preserve runtime-only model behavior and cannot reintroduce a gateway stall.
  • Resolve merge risk (P1) - The PR body reports production net growth of +8 lines for a bug fix; without source access, this review could not determine whether the three call-site options can be absorbed into the catalog owner more coherently.
  • Complete next step (P2) - A protected maintainer PR affecting shared gateway availability needs exact-head catalog-owner review; the local reviewer could not perform it because the sandbox failed before any read-only command ran.
Agent review details

Security

None.

PR surface

Source +8, Tests +77. Total +85 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 17 9 +8
Tests 3 102 25 +77
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 119 34 +85

Review metrics

Metric Value Why it matters
Production versus test delta production +17/-9 (net +8); tests +102/-25 The PR reports focused regression coverage for three paths, while the positive production delta needs an owner-boundary check before merge.

Merge-risk options

Maintainer options:

  1. Verify provider-bounded discovery before merge (recommended)
    Confirm on the exact head that scoped startup, fallback, and spawn reads cannot materialize the full catalog while still finding runtime-only models for the selected provider.
  2. Pause until source review is available
    Do not rely only on the PR narrative and CI summary for this shared gateway availability boundary.

Technical review

Best possible solution:

Re-run an exact-head source and history review of the prepared-catalog owner and all three callers, then merge only if scoped live discovery remains provider-bounded while preserving runtime-only model capability checks.

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

No: the local runner could not execute even read-only inspection commands, so the PR’s claimed focused regressions could not be independently checked.

Is this the best way to solve the issue?

Unclear: provider-scoped reads match the stated owner boundary, but the catalog helper and sibling callers could not be inspected to confirm this is the narrowest safe repair.

AGENTS.md: unclear because the file could not be read completely.

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

Labels

Label changes:

  • add P1: The PR targets a reported full provider-discovery path that can stall Gateway responsiveness during startup or agent work.
  • add merge-risk: 🚨 availability: The changed catalog-discovery flags govern whether gateway-adjacent reads may fan out into broad provider loading.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies this as a protected maintainer PR; contributor real-behavior proof is not the applicable gate, although its claimed runtime validation still needs independent exact-head review.

Label justifications:

  • P1: The PR targets a reported full provider-discovery path that can stall Gateway responsiveness during startup or agent work.
  • merge-risk: 🚨 availability: The changed catalog-discovery flags govern whether gateway-adjacent reads may fan out into broad provider loading.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies this as a protected maintainer PR; contributor real-behavior proof is not the applicable gate, although its claimed runtime validation still needs independent exact-head review.

Evidence

What I checked:

  • PR-stated regression coverage: The supplied PR body reports three focused regressions covering Gmail validation, fallback thinking hydration, and structured-output spawn checks, with full-catalog counters remaining zero after the branch change. (23e29ee5c7e4)
  • Related merged work: The supplied context identifies merged PR perf(agents): keep turn-path model catalog reads off the full live build #120834 as the provider-scoped catalog helper’s originating repair and fix(cron): prevent cold turns from blocking the gateway #123368 as a related cold-turn availability repair. (7a8eee4a363b)
  • Inspection infrastructure failure: The required read-only checkout inspection could not begin: the sandbox rejected commands before execution with a bwrap loopback permission error, so this review does not claim source, test, history, or AGENTS.md inspection.

Likely related people:

  • steipete: The supplied related history attributes the lifecycle-owned catalog refactor, provider-scoped follow-up, cron sibling repair, and this branch to steipete. (role: recent area contributor; confidence: medium; commits: 06f5f73e4731, 7a8eee4a363b, 1622c4f0f9e7; files: src/agents/command/run-embedded-attempt.ts, src/gateway/server-startup-post-attach.ts, src/agents/subagents/spawn/subagent-spawn-child-plan.ts)
  • civiltox: The supplied context identifies civiltox as author of the merged runtime-selected-model thinking repair that this PR’s fallback path builds upon. (role: adjacent feature contributor; confidence: low; commits: f943a94a3303; files: src/agents/command/run-embedded-attempt.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Obtain an exact-head review of the prepared-catalog helper and all three changed callers.
  • Reconfirm the reported focused regression results after any rebase.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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