Repository navigation
fix: keep session assessments and recaps working when Codex runs from a configured command - #208733
Conversation
…mand Session observer assessments, Activity recaps and conversation labels pass an internal answerTokenBudget. On a ChatGPT-subscription Codex route, that budget made the isolated completion require an owned inference relay, and a configured appServer.command never registers one, so every utility call failed before thread/start and Control UI repeatedly showed that assessments had stopped. Mark harness sampling as streamParamsMode "preferred" when it holds only the internal budget. The Codex harness then prefers the relay on non-API-key routes and runs without the advisory limits when none is owned. Explicit caller limits and API-key routes keep requiring the relay. Verified with focused tests (red on base, green here) and an isolated Gateway using a real ChatGPT login and an explicit Codex 0.172.0 command: the base deferred the Activity recap with the relay error; this build stored a recap.
|
🦞👀 ClawSweeper review completeClawSweeper finished reviewing this revision. |
|
|
Codex review: blocked before merge. What this changesThe PR lets Codex omit internal answer budgets when a subscription route lacks an owned relay, while keeping explicit limits and API-key routes strict. Example: An Activity recap uses openai/gpt-6-luna with a ChatGPT subscription and an explicitly configured appServer.command.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains This PR addresses a current utility-completion failure with no definite correctness findings; the advisory sampling contract still needs an owner decision. Reviewed head: Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherBackground utility callers send prompts and answer budgets through core isolated completion; the Codex harness selects the prepared authentication route and returns text from a bounded native turn. flowchart TD
A[Observer and recap callers] --> B[Core isolated completion]
B --> C[Sampling intent]
C --> D[Codex harness]
D --> E[Owned relay when available]
D --> F[Native subscription without advisory limits]
E --> G[Bounded completion result]
F --> G
Technical reviewBest possible solution: Use the existing completion and relay owners to distinguish advisory internal budgets from mandatory caller limits, with one agreed harness contract. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the configured-command failure path, and the contributor supplies a matching real Gateway reproduction; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch repairs intent loss at the shared sampling owner and reuses existing relay routing, preserving explicit limits, endpoint selection, and authentication boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6442e281211b. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +29, Tests +53, Docs +3. Total +85 across 9 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall readiness starts with the lower of the proof and patch scores. It is capped at 3/6 if the fix is partial, the change offers little benefit, a product decision is still open, or the PR reverses an earlier decision without saying why. ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 29, 2026, 9:55 PM ET / November 30, 2026, 02:55 UTC. |
Closes #204135
What Problem This Solves
When the utility model is a ChatGPT-subscription Codex model, such as
openai/gpt-6-luna, and Codex runs from an explicitly configuredappServer.command, every background utility task fails before inference. Affected tasks include session observer assessments, Activity recaps and generated chat titles. After 2 failures, Control UI shows "Session observer assessments stopped for this run after utility model … failed repeatedly" on run after run. Users read that as something they did wrong, although their chats are unaffected.User Impact
Observer assessments, Activity recaps and conversation labels work again on subscription Codex routes without an owned inference relay. The warning stops appearing. On those routes, the internal answer budget is not applied. That matches what native Codex can do, because
thread/starthas no token or temperature fields.Behavior that stays the same:
streamParamsare still honored or rejected before inference.No configuration change is needed.
Why This Change Was Made
Internal callers already pass their own size cap as
answerTokenBudget, which is documented as an internal budget, while an explicit caller limit goes instreamParams. Today the two are merged into onemaxTokensbefore the harness sees them. AnymaxTokenson a Codex subscription route then makesrequireInferenceRoutetrue. An explicit command never registers relay ownership (commandSource: "config"), so the bounded turn throwsPrepared Codex request requires an owned inference relay.This change keeps that distinction through the harness boundary:
streamParamsMode: "preferred"when the limits come only from the internal answer budget. That includes a temperature the model filter already removed, as for Luna.preferredinference route on non-API-key routes. The bounded turn uses a relay when it owns one and otherwise runs without the advisory limits.requiredkeeps today's error.The field name and meaning follow #196344, which proposed the same advisory intent for ChatGPT token sharing. This PR does not touch that token-sharing branch, so the two compose. The ClawSweeper review on #204135 recommended this direction: keep explicit limits strict and API-key endpoint ownership intact.
Accepted edge case: a temperature-capable subscription model given an explicit internal temperature still needs a relay. No bundled subscription utility model currently accepts temperature.
Evidence
Real Gateway reproduction, before and after. This was an isolated Gateway built from this branch and its base
ed76855c83d, with private state on loopback:plugins.entries.codex.config.appServer.commandpointed at the pinned Codex0.172.0linux-arm64 binary withhomeScope: "user"on a real ChatGPT login. The main and utility model were bothopenai/gpt-6-luna.openclaw agentturn that ran two shell commands. The reply itself succeeded on both builds.answerTokenBudgetplustemperature: 0.2, then the Codex bounded turn.Production observation (anonymized). A Gateway on
2026.11.11with an explicit command and a subscriptionopenai/gpt-6-lunautility model logged 107session observer disabled after consecutive failuresentries with this error over 4 days. Each one showed users the warning above. The first came 12 minutes after the explicit command was hot-reloaded.Focused tests (
pnpm test <files> --maxWorkers=1):src/agents/isolated-completion.budget.test.ts: 7 tests, 49.9 s wall time. Most of that is transform; the tests themselves take 1%. A budget-only request is markedpreferredon host and harness routes; an explicit temperature ormaxTokensis not.extensions/codex/src/app-server/isolated-completion.test.tsandbounded-turn.test.ts: 45 tests, 13.5 s. Subscription plus preferred asks for apreferredroute, strict limits ask forrequired, and API-key staysrequiredeven when the budget is preferred. On a client without an owned relay,preferredruns the turn andrequiredstill throws beforethread/start.Static checks:
pnpm check:changedpasses core and extension typechecks (including tests), changed-file lint and format, import-cycle and boundary guards. Its only failure isplugin boundaries. That failure comes from 2 SDK compatibility records that came due on 2026-11-29 and 2026-11-30 (plugin-sdk-session-agent-resolution-aliases,agent-harness-credential-prompt-string-argument), unrelated to this change. The dead-export scan's findings are all in files this PR doesn't touch. Net test lines: +50, under the 400-line allowance.Codex contract: Codex
rust-v0.172.0ThreadStartParams(codex-rs/app-server-protocol/src/protocol/v2/thread.rs) has nomax_output_tokensortemperature. Only the OpenClaw relay can apply these limits to a native turn.Not exercised: the Control UI observer notice itself in a browser, and the OpenClaw-stored OAuth profile variant with
homeScope: "agent", which needs an interactive device-code sign-in. Both reach the samerunCodexIsolatedCompletion→runBoundedCodexAppServerTurnpath verified above.AI-assisted: investigated, implemented and tested with Claude Opus 5.5 via Claude Code.