Skip to content

fix(setup): subscription model verification misses the published route when Setup checks a configured agent - #198135

Closed
ARAYN7011 wants to merge 1 commit into
openclaw:mainfrom
ARAYN7011:fix/setup-readonly-published-catalog-196817
Closed

ARAYN7011 wants to merge 1 commit into
openclaw:mainfrom
ARAYN7011:fix/setup-readonly-published-catalog-196817

Conversation

@ARAYN7011

Copy link
Copy Markdown

Closes #196817

What Problem This Solves

Fixes: AI setup verification does not see the configured agent's published model route (for example the ChatGPT subscription route) when it checks that agent's model.

User Impact

User impact: Setup's read-only verification now plans authentication against the same published catalog the Gateway announced at startup, so a subscription-backed model is recognized instead of falling through to an empty profile order. No credentials are written, no API key is substituted, and OAuth/auth-policy eligibility is unchanged.

Why This Change Was Made

Setup runs its probe in an isolated read-only runtime under the reserved openclaw agent. When that runtime was admitted, the check that decides whether it may read the configured agent's published catalog compared full owner identities, so the agent id, the read-only flag and config hash, and the Gateway subagent-binding grant all made it unequal. The probe therefore started from an empty catalog. Now that comparison accepts exactly one extra shape: a read-only openclaw request, without subagent binding, whose config is the owner's config plus the openclaw execution entry. Everything else keeps its own catalog.

Technical detail
  • resolveCatalogSourceKey (in prepared-model-runtime.owner.ts) replaces the inline catalog-owner comparison in prepared-model-runtime-lease.ts. It only affects which owner's passive catalog is captured. ownerKey, owner lookup, plugin generations, and execution identity are untouched, and the probe still runs on its own isolated read-only owner.
  • The read-only probe is not granted allowGatewaySubagentBinding. The inverse (owner without binding, request with binding) does not borrow.
  • Altered projections, other agent identities or directories, and skipCredentials requests keep separate catalogs. Execution purpose and plugin selections were already excluded from this comparison and still are.

Evidence

  • New tests in src/agents/prepared-model-runtime.owner-selection.test.ts ("setup read-only catalog capture") drive the real Gateway startup publisher (publishConfiguredModelRuntimeSnapshots), the real setup projection (resolveSystemAgentConfiguredRouteFromConfig), and read-only static acquisition (acquireReadOnlyPreparedModelRuntime).
  • Fail before, pass after (fix reverted, new tests only): 2 of 3 failed with expected [] to deeply equal [ 'gpt-5.5' ]. The third (separation of altered projections and identities) passes either way as a negative control. With the fix: 3 of 3 pass.
  • Negative tests cover an altered projection, a different agent id, a different agent directory, skipCredentials, and an owner without subagent binding versus a request with it.
  • pnpm test src/agents/prepared-model-runtime.owner-selection.test.ts src/agents/prepared-model-runtime.test.ts src/agents/prepared-model-runtime.catalog-owner.test.ts src/system-agent/inference-route.test.ts src/system-agent/setup-inference-turn.test.ts --maxWorkers=1: 5 files, 98 tests passed (25 + 73), including "reuses read-only owners for equivalent config clones but rejects projections" and "keeps an isolated setup probe exact after a gateway replacement".
  • pnpm tsgo:core passes. oxlint is clean on the three touched files, the format check passes, and git diff --check is clean.
  • Gaps: pnpm tsgo:core:test timed out locally before finishing (every shard that completed passed, including the three agents-* shards). Full-repo pnpm lint was not rerun; it reports a pre-existing max-lines error in extensions/crabbox/src/crabbox-worker-node-enrollment.test.ts, which this PR does not touch. No live ready-Gateway openclaw.setup.verify run with a real ChatGPT subscription was performed; evidence comes from the production code path under the prepared-runtime test harness.

@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Nov 13, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 13, 2026
@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR lets a compatible read-only setup runtime capture a configured agent’s published model catalog.

Example: Gateway agent default publishes openai/gpt-5.5 and setup checks it in /tmp/setup-probe-workspace.

  • Before: The isolated runtime misses the published catalog.
  • After: The added test captures the catalog using agentId openclaw, while the shipped caller uses agentId default and still misses it.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The repair targets the right owner, but excludes the real caller and lacks required behavior proof.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Setup verification rejects an existing subscription login despite working normal inference.
Reason: Restoring the configured connection’s published inventory follows the existing shared model-resolution contract without adding settings or changing authentication policy.

Merge readiness

⛔ Blocked before merge - 2 items remain

This PR addresses a current bug, but its new admission condition excludes the configured agent identity used by shipped setup verification.

Priority: P2
Reviewed head: e641701332ae7040568c9c2fc6722193bf295c18

Before merge

  • Add real behavior proof - The PR supplies a mocked in-process owner harness and reported red/green results, but its positive fixture uses a different agent identity from shipped setup; the body explicitly confirms no live subscription verification on this patch, so the contributor must supply the missing result with credentials, IPs, phone numbers, and non-public endpoints redacted. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Match the configured agent ID used by the shipped setup probe (P2) - For a configured agent named default, resolveSystemAgentConfiguredRouteFromConfig returns route.agentId = default, and runSetupInferenceTurn passes that ID plus an agent:default:setup-inference session key into the embedded runner. The runner preserves that identity through read-only runtime acquisition. This openclaw-only condition therefore skips the new projection for the reported user flow, leaving readOnly, config fingerprint, and binding capability unequal to the configured owner and capturing the isolated catalog again. The added setupInput fixture hides this by replacing route.agentId with SYSTEM_AGENT_ID. Match the actual configured-agent setup request while retaining the compatibility checks, and make the regression use the shipped caller’s identity.

Findings

  • [P2] Match the configured agent ID used by the shipped setup probe — src/agents/prepared-model-runtime.owner.ts:317-319

Tests

  • Missing end-to-end proof: Provide redacted terminal output or logs showing this patch’s ready-Gateway openclaw.setup.verify succeeding for a configured agent with existing subscription authentication and no credential writes or API-key substitution.
Agent review details

How this fits together

Gateway startup publishes configured model inventory; runtime admission captures that inventory for isolated model resolution and authentication planning.

flowchart TD
 A[Gateway startup] --> B[Configured catalog owner]
 C[Setup configured agent route] --> D[Read-only runtime admission]
 B --> D
 D --> E[Captured model inventory]
 E --> F[Authentication and inference]
 F --> G[Verification result]
Loading

Technical review

Best possible solution:

Match the actual setup projection under route.agentId in existing catalog admission while preserving configuration, directory, credential, and execution isolation.

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

Source tracing shows that a configured agent named default reaches read-only acquisition as default, skips the new openclaw-only projection, and retains the catalog-key mismatch; no target code was executed.

Is this the best way to solve the issue?

Sharing compatible inventory through the existing owner is the right repair boundary, but the admission condition and regression fixture must use the identity supplied by the real setup caller.

Full review comments:

  • [P2] Match the configured agent ID used by the shipped setup probe — src/agents/prepared-model-runtime.owner.ts:317-319
    For a configured agent named default, resolveSystemAgentConfiguredRouteFromConfig returns route.agentId = default, and runSetupInferenceTurn passes that ID plus an agent:default:setup-inference session key into the embedded runner. The runner preserves that identity through read-only runtime acquisition. This openclaw-only condition therefore skips the new projection for the reported user flow, leaving readOnly, config fingerprint, and binding capability unequal to the configured owner and capturing the isolated catalog again. The added setupInput fixture hides this by replacing route.agentId with SYSTEM_AGENT_ID. Match the actual configured-agent setup request while retaining the compatibility checks, and make the regression use the shipped caller’s identity.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 066c7ecdeccf.

Provenance checked

  • Published executable catalog capture keeps the original intent (4557e7e: New execution leases must capture published executable discovery rows while existing leases retain their admitted facts.)
  • Catalog identity exclusions changes intended behavior with a stated reason (4c3bf18: Isolated completions need configured inventory while retaining separate plugin execution generations; this PR explains extending compatible capture to read-only setup projections.)
  • Configured inventory versus execution workspace keeps the original intent (52885d9: An execution folder outside the agent workspace must not discard the configured agent’s published models.)
  • Reserved setup identity ownership keeps the original intent (6a40898: Reserved setup runs may derive ownership through the configured agent directory without weakening ordinary agent identity.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/agents/prepared-model-runtime.owner-selection.test.ts src/agents/prepared-model-runtime.test.ts src/agents/prepared-model-runtime.catalog-owner.test.ts src/system-agent/inference-route.test.ts src/system-agent/setup-inference-turn.test.ts --maxWorkers=1
  • pnpm tsgo:core
  • pnpm tsgo:core:test
  • git diff --check
  • Demonstrate the configured-agent regression failing on the base and passing with the repair.

What I checked:

PR surface

Source +32, Tests +85. Total +117 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 45 13 +32
Tests 1 85 0 +85
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 130 13 +117

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #196817
Summary: Two open PRs target the catalog-loss defect tracked by the canonical issue; neither currently establishes a safely landable replacement.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The demonstrated failure affects configured-agent setup verification while ordinary inference works; broader first-run blockage is not established.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 13, 2026, 1:32 AM ET / 06:32 UTC.

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

Labels

agents Agent runtime and tooling 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.

[Bug]: Setup inference loses published subscription routes and rejects usable OAuth

1 participant