Repository navigation
fix(agents): preserve model ownership across Codex chat turns - #136754
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Real concrete-chat before/after proofAfter: a7c8086df55. Before: b3fcdf31620. The first screenshot is the untouched baseline: both normal-composer turns fail before provider inference at the false session-pinned harness assertion. The second screenshot and video show the repaired flow: Both repaired calls returned HTTP 200 through the real Responses API, and both actual outgoing request summaries retained Source-built isolated Gateway and real Control UI/provider; no mock Gateway/provider or UI bypass. Every attached capture was inspected and contains only synthetic data. The proof instance was stopped and its isolated runtime removed. The misleading concrete “Codex-controlled model” picker label is a separate existing follow-up, not the ownership source. attachment-672979570.webm |
Real native-supervision before/after proofAfter: a7c8086df55. Before: b3fcdf31620. The first screenshot is the untouched baseline: the imported native source has already answered successfully, but the composer blocks continuation on unrelated missing host credentials. The second screenshot and video show both repaired normal-composer turns recalling The native model was deliberately different from the outer configured model. After each turn, private binding, durable session and public A second fresh run omitted the native model from the host catalog entirely. It also completed both turns and did not fabricate a catalog row. This is API-key-backed native supervision, not OAuth account-identity proof or the separate tool-only native-finalizer work. Source-built isolated Gateway, real Control UI and real pinned Codex/OpenAI inference; no direct state mutation or auth/UI bypass. Every attached capture was inspected and contains only synthetic data. All proof instances were stopped and their isolated runtimes removed. attachment-3921213278.webm |
Ownership proof and exact local commandsCurrent head: 9ecdfc746b6d, based on Original integrated runtime/live-proof head: OPENCLAW_VITEST_MAX_WORKERS=4 node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/backend.test.ts src/agents/embedded-agent-runner/run/model-setup.ownership.test.ts src/agents/embedded-agent-runner/run/terminal-preparation.test.ts src/agents/embedded-agent-runner/run/settled-turn-finalization.test.ts src/agents/embedded-agent-runner/run.harness-auth-failover.test.ts src/agents/embedded-agent-runner/run/auth-plan.auth-pin.test.ts src/agents/command/attempt-execution.cli.test.ts src/auto-reply/reply/agent-runner-result-accounting.persistence.test.ts src/auto-reply/reply/agent-runner-memory.test.ts src/gateway/server-methods/chat-metadata-runtime.test.ts src/gateway/server-methods/chat-metadata-runtime.native-session.test.ts src/gateway/session-utils.test.ts extensions/codex/harness.session-runtime-ownership.test.ts extensions/codex/src/app-server/thread-lifecycle.test.ts extensions/codex/src/app-server/run-attempt.context-engine.test.ts extensions/codex/src/app-server/run-attempt.test.tsResult: 1,113 passed, 16 files, six shards; wrapper exit 0 in 950.85 seconds. Per-shard counts: Gateway 274, accounting/memory 179, embedded-agent 16, embedded-agent-run 70, CLI/support 143, Codex 431. The Gateway count is one lower than the prior base because main removed an obsolete cache-internal test; all new native ownership coverage is retained. pnpm buildResult: exit 0 in 497.40 seconds, including SDK/unified declarations, bundled plugins, Control UI and its performance checks. No ineffective-dynamic-import warning. git diff --checkResult: pass. git range-diff b3fcdf31620d5c829554f65566a494385823fed6..9544c8c80eb 94edd0f0d5fc0f124c21a2a6f7b4e4f25c847489..a7c8086df55ec56a625f58768506788783caae9dResult: first commit unchanged; second commit differs only in import context, preserving main's deletion of obsolete CLI binding writers. Fresh full-branch independent Codex autoreview returned scoped-clean at P0 across two complete bounded passes; no reviewer isolation or secret scanning was bypassed. CI repair and final compatibility coverageCI repair head before the conflict rebase: f5d1809ca367. The first CI run found a Madge type dependency cycle and five stale assertions in two test files. All failures reproduced locally. pnpm check:architecturePass, 226.90 seconds: zero runtime cycles, zero Madge cycles, and every subsequent architecture/database guard passed. Before the repair, the same Madge check reported one cycle. pnpm buildPass after the type-only fix, 367.69 seconds, with no ineffective-dynamic-import warning. OPENCLAW_VITEST_MAX_WORKERS=4 node scripts/run-vitest.mjs src/gateway/server-methods/chat-history-handler.test.ts src/agents/embedded-agent-runner/run.overflow-compaction.loop.test.ts src/agents/embedded-agent-runner/run/model-setup.ownership.test.ts src/agents/embedded-agent-runner/run.harness-auth-failover.test.ts extensions/codex/harness.session-runtime-ownership.test.ts extensions/codex/src/app-server/session-binding.test.ts extensions/codex/src/app-server/thread-lifecycle.binding.test.ts extensions/codex/src/app-server/startup-binding.test.ts extensions/codex/src/app-server/upstream-session-fork-continuation.test.ts extensions/codex/src/app-server/run-attempt-connection.test.tsPass: 369 tests, 10 files, four shards, 457.02 seconds on the final source. This covers persisted locked-session ownership, host/native authentication, saved binding reads, lifecycle generations, pending supervision materialization, native resume preservation and both repaired assertion boundaries. node scripts/check-changed.mjs -- src/agents/harness/types.ts src/gateway/server-methods/chat-history-handler.test.ts src/agents/embedded-agent-runner/run.overflow-compaction.loop.test.tsPass, along with formatting and a fresh independent P0 autoreview of all three follow-up files. Conflict rebase verificationMain added finalization coverage in the same native transport test, making the first CI-fix head unmergeable. The rebase preserves that production change and table-drives both final-answer and tool-only cases, retaining native attribution, source/transcript/replay safeguards, native-auth finalization unavailability, and transport/home rejection. The first ownership commit and CI-fix commit are patch-identical; the middle commit changes only this test composition relative to the previously reviewed delta. OPENCLAW_VITEST_MAX_WORKERS=4 node scripts/run-vitest.mjs extensions/codex/src/app-server/run-attempt.test.ts src/agents/embedded-agent-runner/run/settled-turn-finalization.test.ts src/agents/embedded-agent-runner/run/model-setup.ownership.test.ts src/agents/embedded-agent-runner/run.overflow-compaction.loop.test.ts src/gateway/server-methods/chat-history-handler.test.tsPass on current head: 240 tests, five files, four shards, 194.54 seconds, including both final-answer and tool-only native paths and both repaired assertion files. node scripts/check-changed.mjs -- extensions/codex/src/app-server/run-attempt.test.ts extensions/codex/src/app-server/run-attempt-finalize.ts src/agents/embedded-agent-runner/run/settled-turn-finalization.test.tsPass, 638.11 seconds. A normal ClawSweeper acceptance and rank-up dispositionAddressing the review's compatibility requests and rank-up move:
Final merged-CI follow-upThe next CI run tested merge node scripts/run-oxlint.mjs --tsconfig tsconfig.json src/gateway/server-methods/chat-metadata-runtime.ts src/gateway/server-methods/chat-metadata-session-projection.tsnode scripts/run-vitest.mjs src/gateway/server-methods/chat-metadata-runtime src/gateway/server-methods/chat-history-handler.test.ts src/gateway/server-chat-metadata-lifecycleThose two commands ran in the exact CI merge snapshot with only the reviewed fix overlaid; source and lifetime ordering were inspected. No line-limit suppression or limit change was made. CI also exposed a LINE startup test that left its real optional HTTP probe unmocked while polling monitor entry for one second. The fixture now uses the existing local HTTP responses, observes provider entry or early task settlement, and always aborts/joins. Credential/account/status assertions remain, abort-signal forwarding is checked, and two casts were removed through the actual monitor parameter type. The precise delayed-versus-early-error state of the original CI run remains unknown; no timeout or retry was added. node scripts/run-vitest.mjs extensions/linePass: 838 tests, 54 files, 73.18 seconds. node scripts/check-changed.mjs -- src/gateway/server-methods/chat-metadata-runtime.ts extensions/line/src/setup-surface.test.ts src/gateway/server-methods/chat-metadata-session-projection.tsPass, 921.86 seconds. The normal build passed again (577.07 seconds), with no ineffective-dynamic-import warning. Fresh independent review of the complete follow-up plus the merged metadata file returned scoped-clean at P0. The third failure was shared main's UI budget, reproduced in an isolated exact-tree build at 349385 B against a 349244 B limit (CI measured 349396 B). None of this PR's changed modules appeared in boot source maps. The already-open UI budget PR #136817 has merged as bf5753075a54; this PR makes no UI or budget-baseline changes. The next source push incorporated that upstream fix into CI's merge snapshot. The following CI run passed the JS budget but exposed two further shared-main failures: startup CSS exceeded the existing cap by 17 bytes, and two artifact tests still expected Corrective rebase with fixes in branch ancestryThe branch is now rebased onto git range-diff 14f502a277bd4c27b0360f3727f2973b0d0362f2..cd7e5e4e937469c413551a12b2b0b8db8aacb9e7 e284f6597f48ad6013d66530fc0560e5ce3793fc..9ecdfc746b6d92bd69d81c1495549b1f6dc8226dOPENCLAW_VITEST_MAX_WORKERS=4 node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/model-setup.ownership.test.ts src/agents/embedded-agent-runner/run/backend.test.ts src/agents/embedded-agent-runner/run/settled-turn-finalization.test.ts extensions/codex/src/app-server/run-attempt.test.ts extensions/codex/src/app-server/run-attempt-connection.test.ts src/gateway/server-methods/chat-metadata-runtime src/gateway/server-methods/chat-history-handler.test.ts src/gateway/server-chat-metadata-lifecycle test/scripts/repo-e2e-artifacts.test.ts packages/llm-core/src/utils/event-stream.test.tsPass: 356 tests, 13 files, five shards, 556.63 seconds. This includes the previously failing artifact boundary, native startup/ownership/finalization, metadata shutdown and incoming event-stream retention. pnpm buildPass: 1100.83 seconds, including all SDK/bundled/runtime outputs, Control UI and both performance budgets. No ineffective-dynamic-import warning. Fresh full-branch independent Codex autoreview returns scoped-clean at P0 across two complete passes, with no findings. Read-only integration inspection confirms worker GitHub bindings remain exec-environment facts, cloud workers still exclude native harness execution, and event-stream queue release does not erase its separately owned terminal result or Codex's ready-thread selection. Production/test/docs LOC are unchanged. No extra feature or fallback was introduced to obtain green proof. Exact-head CI 33715145287 passed on the new head: 141 successful jobs, 16 intentionally skipped; required Native prepare receiptOPENCLAW_TESTBOX=1 scripts/pr prepare-run 136754Passed. Hosted CI/Testbox gates were accepted through |
|
Codex review: blocked before merge. Reviewed September 3, 2026, 12:40 AM ET / 04:40 UTC. ClawSweeper reviewWhat this changesThe PR preserves a pinned Codex session’s native or host-owned model selection across chat turns and projects the resulting model into session metadata and accounting. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 7 items remain Keep open: source review supports the repair, but the new generic AgentHarness ownership contract needs area-owner acceptance and exact-head CI completion. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw’s embedded agent runner selects a model and harness for each session turn. For a pinned Codex App Server thread, this change reads the authoritative binding first and rechecks that ownership before continuing the native thread. flowchart LR
A[Incoming chat turn] --> B[Session admission]
B --> C[Read pinned runtime ownership]
C --> D[Prepare model and harness]
D --> E[Codex thread resume]
E --> F[Start native turn]
F --> G[Session metadata and accounting]
Decision needed
Why: This deliberately expands a compatibility-sensitive plugin contract across session selection and authentication; source review cannot substitute for owner intent. Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Accept the documented callback only if the agent-harness owner confirms it is the canonical cross-plugin ownership seam, then complete exact-head CI. Do we have a high-confidence way to reproduce the issue? No independent high-confidence current-main reproduction was established in this read-only review; source inspection and the reported before/after flow make the path source-reproducible. Is this the best way to solve the issue? Yes in source review: the binding is the authoritative owner of the model/auth tuple, and the patch revalidates it before lifecycle and turn side effects; the generic seam still needs owner acceptance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 84966331a760. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Import ModelRef from its defining contract rather than the model-selection facade, removing the Madge dependency cycle without changing runtime code. Keep metadata assertions explicit about canonical session scope. Assert one prepared dispatch and absent native ownership without coupling the tests to omitted versus explicit undefined argument arity. Follow-up for #136754. Reproduced the architecture failure and all five test assertion failures from CI run 33697493195 before editing. Full architecture, normal build, changed checks, 369 ownership/binding/lifecycle tests and fresh Codex P0 autoreview pass. No guard, assertion invariant, timeout, config or stored-data representation was weakened or changed.
f5d1809 to
78e1cdb
Compare
Keep the uncached synchronous session ownership overlay separate from the shared metadata cache and lifecycle owner. Preserve projection/config/read ordering, missing-row behavior and native/host auth distinctions. The exact CI merge with main's stop/activeWork handling exceeded max-lines. This extraction reduces it from 728 to 695 logical lines without suppressing the guard or changing lifecycle behavior. No stored representation or public config changes. Net production growth is four module/type boundary lines. Proof: exact merged-file lint; 80 metadata/shutdown/lifecycle tests; changed checks; normal build; fresh Codex P0 autoreview. Follow-up for #136754.
Use the existing HTTP fixture for startup's real optional bot probe. Observe actual provider entry or early task settlement instead of polling for one second, retain account/credential/status assertions, and always abort/join. Type monitor parameters from their owner and assert abort-signal forwarding. CI exposed an unmocked probe before monitor startup; the exact remote pending versus early-error outcome remains unknown. No timeout, retry, broad mock or production seam is added. The full LINE lane passes 838 tests, and changed checks plus independent review pass. Bounded CI cleanup for #136754.
Keep concrete locked model chats on model discovery and host auth instead of promoting requested or observed runtimes into native ownership. Preserve real Responses compaction parameters through declared transport fallback, including subsequent turns after usage persistence records the producing harness. Resolve native model and connection ownership from the existing private binding, revalidate it across preparation and dispatch, and preserve expected native state before recovery can replace it. Keep supervision auth separate from native model preservation and ordinary host-auth failover. Align command, reply, memory, compaction, voice, and plugin execution callers without new SDK exports or stores.
…ounting Read private session ownership through one synchronous generation-checked binding boundary. Keep native model and native auth ownership distinct, prepare host credentials for the actual native tuple, and reject stale ownership before dispatch, connection, lease use, and resumed turn start. Project the actual ready native model into session metadata without requiring unrelated host credentials or inventing catalog availability. Keep session selection separate from finalizer response and billing attribution. Preserve authored Responses controls for concrete model chats and observed producer metadata across subsequent turns. Migrate binding reads to the canonical synchronous API and repair nearby fixture ownership/timing assumptions without relaxing assertions or timeouts. No config option, dependency, schema, persisted mirror, or protocol change. Related: #118642 (native catalog sessions resolving the outer default model). Reporter: @RothElektronik. Proof: composed owner regressions; final Codex matrix 1713 tests; core and Gateway matrices 84 and 275 tests; aggregate changed checks; normal build; SDK surface; full candidate P0 autoreview. Real isolated two-turn concrete, listed-native, and unlisted-native dashboard flows pass. Responses controls, native credentials, source history, thread identity, and public model checked.
Import ModelRef from its defining contract rather than the model-selection facade, removing the Madge dependency cycle without changing runtime code. Keep metadata assertions explicit about canonical session scope. Assert one prepared dispatch and absent native ownership without coupling the tests to omitted versus explicit undefined argument arity. Follow-up for #136754. Reproduced the architecture failure and all five test assertion failures from CI run 33697493195 before editing. Full architecture, normal build, changed checks, 369 ownership/binding/lifecycle tests and fresh Codex P0 autoreview pass. No guard, assertion invariant, timeout, config or stored-data representation was weakened or changed.
Keep the uncached synchronous session ownership overlay separate from the shared metadata cache and lifecycle owner. Preserve projection/config/read ordering, missing-row behavior and native/host auth distinctions. The exact CI merge with main's stop/activeWork handling exceeded max-lines. This extraction reduces it from 728 to 695 logical lines without suppressing the guard or changing lifecycle behavior. No stored representation or public config changes. Net production growth is four module/type boundary lines. Proof: exact merged-file lint; 80 metadata/shutdown/lifecycle tests; changed checks; normal build; fresh Codex P0 autoreview. Follow-up for #136754.
Use the existing HTTP fixture for startup's real optional bot probe. Observe actual provider entry or early task settlement instead of polling for one second, retain account/credential/status assertions, and always abort/join. Type monitor parameters from their owner and assert abort-signal forwarding. CI exposed an unmocked probe before monitor startup; the exact remote pending versus early-error outcome remains unknown. No timeout, retry, broad mock or production seam is added. The full LINE lane passes 838 tests, and changed checks plus independent review pass. Bounded CI cleanup for #136754.
cd7e5e4 to
9ecdfc7
Compare
|
Merged via squash.
|
…aw#136754) * fix(agents): separate native ownership from runtime selection Keep concrete locked model chats on model discovery and host auth instead of promoting requested or observed runtimes into native ownership. Preserve real Responses compaction parameters through declared transport fallback, including subsequent turns after usage persistence records the producing harness. Resolve native model and connection ownership from the existing private binding, revalidate it across preparation and dispatch, and preserve expected native state before recovery can replace it. Keep supervision auth separate from native model preservation and ordinary host-auth failover. Align command, reply, memory, compaction, voice, and plugin execution callers without new SDK exports or stores. * fix(agents): preserve native model ownership through metadata and accounting Read private session ownership through one synchronous generation-checked binding boundary. Keep native model and native auth ownership distinct, prepare host credentials for the actual native tuple, and reject stale ownership before dispatch, connection, lease use, and resumed turn start. Project the actual ready native model into session metadata without requiring unrelated host credentials or inventing catalog availability. Keep session selection separate from finalizer response and billing attribution. Preserve authored Responses controls for concrete model chats and observed producer metadata across subsequent turns. Migrate binding reads to the canonical synchronous API and repair nearby fixture ownership/timing assumptions without relaxing assertions or timeouts. No config option, dependency, schema, persisted mirror, or protocol change. Related: openclaw#118642 (native catalog sessions resolving the outer default model). Reporter: @RothElektronik. Proof: composed owner regressions; final Codex matrix 1713 tests; core and Gateway matrices 84 and 275 tests; aggregate changed checks; normal build; SDK surface; full candidate P0 autoreview. Real isolated two-turn concrete, listed-native, and unlisted-native dashboard flows pass. Responses controls, native credentials, source history, thread identity, and public model checked. * fix(agents): keep ownership types off the routing facade Import ModelRef from its defining contract rather than the model-selection facade, removing the Madge dependency cycle without changing runtime code. Keep metadata assertions explicit about canonical session scope. Assert one prepared dispatch and absent native ownership without coupling the tests to omitted versus explicit undefined argument arity. Follow-up for openclaw#136754. Reproduced the architecture failure and all five test assertion failures from CI run 33697493195 before editing. Full architecture, normal build, changed checks, 369 ownership/binding/lifecycle tests and fresh Codex P0 autoreview pass. No guard, assertion invariant, timeout, config or stored-data representation was weakened or changed. * refactor(gateway): isolate session-specific model metadata Keep the uncached synchronous session ownership overlay separate from the shared metadata cache and lifecycle owner. Preserve projection/config/read ordering, missing-row behavior and native/host auth distinctions. The exact CI merge with main's stop/activeWork handling exceeded max-lines. This extraction reduces it from 728 to 695 logical lines without suppressing the guard or changing lifecycle behavior. No stored representation or public config changes. Net production growth is four module/type boundary lines. Proof: exact merged-file lint; 80 metadata/shutdown/lifecycle tests; changed checks; normal build; fresh Codex P0 autoreview. Follow-up for openclaw#136754. * test(line): isolate account startup probe and cleanup Use the existing HTTP fixture for startup's real optional bot probe. Observe actual provider entry or early task settlement instead of polling for one second, retain account/credential/status assertions, and always abort/join. Type monitor parameters from their owner and assert abort-signal forwarding. CI exposed an unmocked probe before monitor startup; the exact remote pending versus early-error outcome remains unknown. No timeout, retry, broad mock or production seam is added. The full LINE lane passes 838 tests, and changed checks plus independent review pass. Bounded CI cleanup for openclaw#136754.
Keep the selected catalog label or qualified model reference visible in locked Control UI chats. Use Session model only when the selection is unknown, and preserve the existing lock and model mutation guards. Remove runtime-based ownership labeling and document that model editability does not establish native ownership. Cover canonical Gateway rows, missing catalog metadata, and runtime-independent labels with regression tests. Fixes #137039. UI follow-up to #136754; runtime behavior is unchanged.
* fix(ui): show concrete model names in locked chats Keep the selected catalog label or qualified model reference visible in locked Control UI chats. Use Session model only when the selection is unknown, and preserve the existing lock and model mutation guards. Remove runtime-based ownership labeling and document that model editability does not establish native ownership. Cover canonical Gateway rows, missing catalog metadata, and runtime-independent labels with regression tests. Fixes #137039. UI follow-up to #136754; runtime behavior is unchanged. * test(cron): synchronize timeout probe with child readiness Freeze deadline timers until the real shell publishes a live descendant, then advance the unchanged 0.5-second timeout and termination grace. This keeps startup latency from consuming the process-group cleanup proof. Reuse canonical PID and temporary-directory helpers and clean up processes, timers, and the spawn spy even when setup fails. Cron runtime is unchanged. Proof: all 10 command-runner tests, 10 sequential timeout-probe runs, inherited-pipe descendant coverage, and deliberate setup-failure cleanup. CI follow-through for #137041. * fix(android): preserve new-turn scroll while history settles Only include history loading in the reader effect key for empty timelines, where it changes the transition. Populated-history completion must not cancel a scroll after the owner records its new content version. Reproduce loading completion during an observably moving animation and require arrival at the newest turn. Preserve manual takeover and replacement animation behavior without changing the full-message fixture. Fixes #137111. Found during CI follow-through for #137041. Proof: old owner stops at item 32/offset 141; repaired owner reaches 0/0. All 57 reader/full-message tests, Kotlin lint, nine-file changed checks, and :app:assemblePlayDebug pass. Native visual proof remains pending. * test(update): expect system actor for gateway dispatch Match the canonical in-process Gateway actor in the existing update tool and /update exact-call assertions. Main now propagates the system actor; these two expectations were missed while the shared helper tests changed. Four failures reproduced on the CI merge baseline. All 50 owner and sibling tests pass after the two-line expectation repair. Runtime behavior, scopes, routing checks, mocks, and timeouts are unchanged. Refs #137041. * test(android): await rendered Settings reply completion Wait for the actual enabled composer after the atomic reply state is published. Preserve publication-only waits for frozen-clock geometry tests and keep the existing timeout and reading assertions. CI follow-through for #137041; controlled notification ordering reproduces the original stale working-row assertion. * fix(android): publish WebSocket before handshake sends Serialize socket publication with the existing transport write lock so an early OkHttp callback cannot send through an unpublished handle. Revalidate closure after waiting for that lock so a retired handshake cannot enqueue. A real-socket regression holds the asynchronous factory return, reproduces the pre-fix gateway send failure, and covers disconnect during publication. No auth policy, wire payload, retry, or timeout changes. Fixes #137404; CI follow-through for #137041.
* fix(ui): show concrete model names in locked chats Keep the selected catalog label or qualified model reference visible in locked Control UI chats. Use Session model only when the selection is unknown, and preserve the existing lock and model mutation guards. Remove runtime-based ownership labeling and document that model editability does not establish native ownership. Cover canonical Gateway rows, missing catalog metadata, and runtime-independent labels with regression tests. Fixes openclaw#137039. UI follow-up to openclaw#136754; runtime behavior is unchanged. * test(cron): synchronize timeout probe with child readiness Freeze deadline timers until the real shell publishes a live descendant, then advance the unchanged 0.5-second timeout and termination grace. This keeps startup latency from consuming the process-group cleanup proof. Reuse canonical PID and temporary-directory helpers and clean up processes, timers, and the spawn spy even when setup fails. Cron runtime is unchanged. Proof: all 10 command-runner tests, 10 sequential timeout-probe runs, inherited-pipe descendant coverage, and deliberate setup-failure cleanup. CI follow-through for openclaw#137041. * fix(android): preserve new-turn scroll while history settles Only include history loading in the reader effect key for empty timelines, where it changes the transition. Populated-history completion must not cancel a scroll after the owner records its new content version. Reproduce loading completion during an observably moving animation and require arrival at the newest turn. Preserve manual takeover and replacement animation behavior without changing the full-message fixture. Fixes openclaw#137111. Found during CI follow-through for openclaw#137041. Proof: old owner stops at item 32/offset 141; repaired owner reaches 0/0. All 57 reader/full-message tests, Kotlin lint, nine-file changed checks, and :app:assemblePlayDebug pass. Native visual proof remains pending. * test(update): expect system actor for gateway dispatch Match the canonical in-process Gateway actor in the existing update tool and /update exact-call assertions. Main now propagates the system actor; these two expectations were missed while the shared helper tests changed. Four failures reproduced on the CI merge baseline. All 50 owner and sibling tests pass after the two-line expectation repair. Runtime behavior, scopes, routing checks, mocks, and timeouts are unchanged. Refs openclaw#137041. * test(android): await rendered Settings reply completion Wait for the actual enabled composer after the atomic reply state is published. Preserve publication-only waits for frozen-clock geometry tests and keep the existing timeout and reading assertions. CI follow-through for openclaw#137041; controlled notification ordering reproduces the original stale working-row assertion. * fix(android): publish WebSocket before handshake sends Serialize socket publication with the existing transport write lock so an early OkHttp callback cannot send through an unpublished handle. Revalidate closure after waiting for that lock so a retired handshake cannot enqueue. A real-socket regression holds the asynchronous factory return, reproduces the pre-fix gateway send failure, and covers disconnect during publication. No auth policy, wire payload, retry, or timeout changes. Fixes openclaw#137404; CI follow-through for openclaw#137041.




Closes #118642 — native catalog continuation resolves the outer default model instead of the native snapshot model. Reported by @RothElektronik.
Additional instructions
Allow edits from maintainers is enabled by using a branch in the canonical repository.
What Problem This Solves
Fixes an issue where users continuing explicit, model-locked Codex model chats could fail before sending a request when their authored transport controls required OpenClaw's lossless runtime fallback. Recording the runtime that produced a reply could also misclassify the next turn.
Imported native sessions had a related ownership failure: a working native connection could be blocked by an unrelated host-provider credential warning, and the session could report the outer default model instead of its native selection. A separate response finalizer could then be mistaken for a session model switch.
Why This Change Was Made
Requested runtime, observed producer, concrete model locking, native model ownership, and native authentication are different facts. One synchronous, generation-checked private-binding read now serves execution preparation and session metadata; lease, mutation, and authentication machinery stay with their existing owners. Native selection remains separate from response and billing attribution through finalization, accounting, and queued follow-ups.
Host-auth native runs prepare credentials and authored controls for the actual private provider/model tuple, then recheck it before dispatch, connection, under the binding lease, and after resume before inference. Native-auth supervision retains its own connection and may follow native model changes. The existing fork/start native snapshot materializer is preserved.
User Impact
Concrete model chats retain their selected model, requested runtime, plugin owner, and real authored Responses parameters across turns, even when OpenClaw produces the response. Native sessions can continue without an unrelated host-provider key or a matching outer default model.
Session metadata omits inapplicable host-auth availability fields only for the native session's rendered model. It does not claim native credentials are ready, mutate shared model availability, or fabricate a missing catalog row. A pending native branch may show the configured placeholder until its first turn establishes the actual tuple.
Automatic host profile retry remains distinct from strict authored profile locks. Missing/changed ownership fails closed without replacing the native thread; incomplete host-auth tuples cannot borrow the outer model. No configuration option, dependency update, storage schema, persisted ownership mirror, or Gateway protocol schema is added.
The sidebar + terminal change in #136230 — open native CLIs from Codex and Claude catalog groups — remains separate and is preserved. The separate tool-only/empty-answer native-finalizer implementation is not imported here.
Evidence
Real before/after behavior
Source-built Gateways, the real dashboard composer, real OpenAI inference, and pinned Codex 0.152.1 were used with fresh isolated state/native homes and nonoperator ports. No operator Gateway/state, mock provider, database mutation, host-auth substitution, or UI bypass was used.
ORBIT-CEDAR; both outgoing requests retainedcontext_managementandstore=trueNATIVE-ORBIT, and kept the native provider/modelAfter each concrete turn, durable requested runtime remained
codex, observed producer wasopenclaw, and concrete model/owner/lock were unchanged. After every native turn, private binding, durable session andsessions.listagreed onopenai/gpt-5.6-luna; native credential bytes, source history, source lineage and canonical thread stayed unchanged. Host auth profile stores remained empty. All six turns emitted final chat events and visibly rendered their expected answers.All before/after screenshots and complete recording contact sheets were inspected and contain only synthetic conversations and the isolated app. Inspected media: concrete before/after and native before/after. The three exact-head candidate recordings are 12.12 seconds (concrete), 10.68 seconds (listed native) and 8.32 seconds (unlisted native). All owned Gateway/native processes were stopped and ports released.
Regression and static proof
The integrated ownership/accounting/Gateway/Codex/caller selection passed 2,458 tests across 46 files before the final synchronous-call cleanup. Final targeted reruns passed 1,713 Codex tests across 34 files, 84 core ownership tests, and 275 Gateway tests. The reply E2E run selected the changed fallback behavior; 165 unrelated cases were not selected. Regression failures were captured before the corresponding repairs, including wrong host-auth tuple preparation, stale credentials across resume, and a distinct finalizer/native selection with different configured prices.
Aggregate changed checks passed, the full normal build including Control UI passed, the SDK surface check passed, and full-candidate independent Codex autoreview returned zero accepted findings at the requested P0-only threshold. That review is scoped evidence, not a claim that all lower-priority findings were exhaustively ruled out.
The initial verification rebase onto
94edd0f0d5fc0f124c21a2a6f7b4e4f25c847489preserved main's CLI settlement/classifier ownership, configured-MCP cleanup, auth-plan test-global removal and Gateway list projection.git range-diffshows the first ownership commit unchanged and only import context changed in the second; the sole conflict retained main's removal of obsolete CLI binding writers plus this patch'sModelReftype.The exact integrated head
a7c8086df55ec56a625f58768506788783caae9dthen passed 1,113 tests across 16 files / six Vitest shards (950.85 seconds), changed-file formatting, the full normal build (497.40 seconds), and a fresh complete branch autoreview (two bounded passes, zero accepted P0 findings). The integration selection covers CLI settlement, host-auth preparation, accounting/memory, Gateway metadata/list projection and native lifecycle/turn execution. All three real two-turn live scenarios were then replayed successfully against that exact integrated build. The first CI run caught a type-only import cycle plus five stale assertions in two boundary test files. Follow-up f5d1809ca367 removes the facade dependency and preserves precise ownership assertions without coupling them to argument arity. The full architecture chain, normal build, 369-test persisted ownership/lifecycle matrix, changed checks and fresh independent review pass. Exact commands and all ClawSweeper compatibility/rank-up dispositions are recorded in the proof comment; new exact-head CI remains required before native landing.Final merge-tree verification found a file-size interaction with main's metadata shutdown handling and an unrelated LINE startup fixture flake. The per-session decorator is now a narrow module, preserving cache/stop ownership while reducing the actual merged runtime from 728 to 695 logical lines. Exact merged-tree lint and 80 metadata/shutdown tests pass; the repaired LINE HTTP/readiness/cleanup fixture passes the full 838-test lane. Changed checks, another normal build and fresh independent review pass. Shared-main UI/build validation failures were handled by the already-open #136817 and #136878, both now merged; no UI or budget baseline is changed here. The latter fixes the 17-byte CSS overage and stale artifact-test expectations. The draft/ready-triggered CI run still checked out GitHub's old
eabe16bamerge into41419be4, so it repeated those fixed failures. A corrective rebase ontoe284f6597f48ad6013d66530fc0560e5ce3793fcnow includes both fixes in the branch ancestry. All five patches are identical ingit range-diff; 356 tests across 13 files (556.63 seconds), the full normal build (1100.83 seconds), and fresh full-branch P0 review pass. Current head is 9ecdfc746b6d, with exact commands and compatibility dispositions in the linked proof comment. Exact-head CI 33715145287 passed: 141 successful jobs, 16 intentionally skipped, including the requiredopenclaw/ci-gate. Its checkout was mergefa068ec0665a9c5f2d232f980781eed761ad20dcinto main7033d859419dcd7f5dbaf2a00ea29c23106ae8b8. Native prepare passed on the same head; its receipt is in the proof comment. The final merge receipt is recorded separately.Dependency contract and solution scope
The acting lead personally inspected sibling Codex
rust-v0.152.1at5adb68a49933ae446bf11935662c83dba55a0804:codex-rs/app-server/src/request_processors/thread_processor.rs:215–268restores persisted selection only without an override;:4003–4019and:5161–5175report the actual configured resume/fork tuple. Native compaction, initialize-originator, and API-key credential-store contracts were also checked directly. Source wrappers or generated protocol types were not used as substitutes for that inspection.The repair removes lock/hint ownership inference, duplicate pin policy, obsolete async-only binding-read chains, and two dead private configuration re-exports. The shared codec is a move, not a second reader. Producer repair was preferred over deleting usage observations, globally declaring auth ready, copying native model state into a new persisted mirror, or bypassing the composer warning.
Production LOC: +1,367/−786, net +581; tests/support: +3,672/−1,381, net +2,291; docs: +146/−32, net +114; one shrink-only ratchet line, net zero. Pure codec/test moves do not represent new behavior. Production growth pays for the shared private ownership/read boundary, exact host-auth tuple freshness, and separation of native session selection from response accounting. The synchronous caller cleanup itself is net-negative. No guard limits or assertions were weakened.
Nearby fixture repairs respond when initialize actually reaches the wire and join cleanup, choose a timezone distinct from the host, use real public SDK exports with narrow logger spies, type the read-only binding fixture instead of hiding an async mock behind casts, and wait for the context-overflow fresh-turn boundary rather than arbitrary polling. The original context-overflow timeout cause was not proven; its deterministic readiness repair retained all request/outcome assertions and the exact 34-file rerun passed. Native metadata tests were moved intact into their own suite using existing support. The assertion baseline only shrinks two removed undocumented casts.
Limits and related follow-ups
Live native proof is API-key-backed supervision, not OAuth account-identity proof. It checks exact credential bytes and connection scope, not independently identified billing-account identity. The concrete proof establishes authored Responses controls, not that a compaction checkpoint was reached. Finalizer/native-model separation is covered by composed accounting regressions, not the separate unpublished native-finalizer dependency patch.
The worker catalog readiness gap in #134460, supervision policy diagnostics in #135310, and provider-card native/direct auth presentation in #129766 are separate open follow-ups, not claimed fixed here. The concrete model-picker's “Codex-controlled model” wording also has a separate scoped follow-up. No release or package publication is part of this PR.