Skip to content

refactor(agents): consolidate remaining runtime lifecycle paths - #168770

Merged
steipete merged 6 commits into
mainfrom
deslop/d31-agents-toplevel-p3-20261007
Oct 11, 2026
Merged

steipete merged 6 commits into
mainfrom
deslop/d31-agents-toplevel-p3-20261007

Conversation

@steipete

@steipete steipete commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Agent runtime maintenance still requires updating repeated auth, execution, catalog, and message-processing paths that perform the same work.

User Impact

No user-visible change. Features, configuration, CLI flags, protocol and stored shapes, tool descriptions, prompts, and error text retain their existing behavior.

Why This Change Was Made

Share those operations within their existing owners, with explicit parameters for real differences. The main reductions cover identity/avatar read lifecycles, exec approval and denial results, shell scanning, model/auth projections, Code Mode dispatch, and message/tool transformations. Authority checks, lazy-loading boundaries, and cleanup ordering remain intact.

This final d31 pass removes 916 production lines (+1,628/-2,544 across 130 files), excluding tests, fixtures, support and generated files. It uses the authorized 500–999-line exception after a completed deep pass: 990 production files have per-file coverage notes. The campaign's 3% target is not claimed. The only test change removes an unused internal argument; every assertion remains.

Evidence

Current candidate: d6012fa46f076da0a5df6d4634bd33f053a19e71, based on 43c68c34df71bed694fc4b1de0725f5e7495b8c1. The named Codex CI gate required integrating upstream #168801, which moves transcript admission outside writer locks. All six lane commits are patch-identical after this conflict-free rebase; all lane production files are byte-identical to the previous reviewed head. The earlier publication conflict repair retains rebuild() -> stage() -> #publish() and main's notification lifecycle.

The coordinator-directed sequential comparison used independent frozen installs on the same machine (Node 26.5.0, pnpm 12.9.0), first clean main, then the candidate. Text-end reconciliation, workspace publication and sandbox publication all passed: 3 files / 33 cases on each revision, in 599.601 and 459.096 wrapper seconds respectively. Main already includes the stream-boundary fix 9931e6efb02 and fs-safe fallback coverage correction 8f1dfe36e47; no assertion or dependency was changed in this lane.

Current-head production types, runtime cycles, Madge, and lint-suppression tests passed; both cycle counts are zero. Full-candidate P0–P2 review on the byte-identical prior head repeated the existing-agent finding discussed below; the complete unchanged guards disprove that path. No actionable finding was accepted. The older evidence below remains explicitly historical.

The previous reviewed head passed the complete native changed-check sequence in 7,499.666 seconds, including every selected type, lint, dead-code, ratchet, and runtime guard. It also passed four rebase-focused files / 28 cases (1,245.016 seconds) and all three wrapper source-closure cases. This proof is retained for the unchanged lane code; new critical runtime context was checked separately on the current head.

The canonical SDK comparison on 45630ed8 → cc8ee8e2 completed in 4,108.786 seconds and was independently reviewed: 151 affected export records (150 reachable changes and the same private-class signature change), zero entrypoint/export additions or removals, and no supported contract difference. All nine declaration pairs match the previously reviewed comparison; the two additional affected gateway-runtime records have identical before/after signatures and empty declaration-change arrays. TLS optional-undefined fields remain intact. Acknowledgement 2bb4f9fc belongs to that exact comparison (full digest 2bb4f9fc5606281a25b69957639de95a0a807306a5aa9886927c8c25213bd2f7); it is reused for unchanged lane bytes, not relabelled as a new comparison.

Upstream #168801 landed after cc8ee8e2 CI's captured base and addresses the investigated writer-lock/admission cycle. With that fix, the exact ten-file selection passes all 168 cases locally on clean main (1,127.746 seconds) and the current candidate (550.809 seconds), using Node 24.19.0 and two workers. The passing candidate includes every previously failing steering, acceptance, persistence, and cleanup case. The hosted Codex sequence still fails on d6012fa4; local passing results do not resolve its attribution. Earlier Node-26 single-worker probes had different startup-budget failures. No test deadline, assertion, retry or skip was added.

Exact-head run 38122624811 completed. The final census is 123 successful checks, 56 scope skips, four failures and one neutral result, with no pending or cancelled checks. All three failed test jobs are independently reproduced on main: the Gateway PID fixture; the stale cat-file blob injection (also repaired upstream by #168975); and the complete six-case Codex sequence. The aggregate only reflects those jobs. The Linux comparison ran all ten Codex files sequentially on main and this head in one secretless Node24.19.0 container: both report 162 passed / 6 failed, with identical case outcomes and detailed errors after normalizing only report formatting and temporary database paths. The exact failed persistence sub-operation remains unproven; matching main failures are not relabelled as passing tests. No timeout, assertion, retry, skip, or scanner policy was changed. The historical tables below remain prior-head evidence.

The final follow-up withdraws a three-line cleanup in bash-tools.exec-request-preparation.ts, returning that file exactly to its integration-base bytes after the changed-path scanner flagged inherited Git-environment lookups. It changes no rule, suppression, signature, import, or runtime contract. Independent P0–P2 review cleared this withdrawal. Four focused files (45 cases, including the lint-suppression guard), production and agents-root test types, lint, formatting, runtime cycles and Madge passed for the follow-up. Runtime and Madge cycles are zero.

The full-candidate proof at 86e56cd remains separately identified below. The complete earlier ordinary selection at b670173 accounted for all 2,048 files but had 65 failed cases. Local validation retains unresolved failures and missing proof; no fully green local or blanket inherited-failure claim is made. Exact-final-head hosted CI remains the landing gate.

Proof Result
Independent P0–P2 review Full candidate 86e56cd: two duplicate findings rejected after complete control-flow inspection; no accepted actionable finding. Final withdrawal: scoped-clean, 271.346 seconds.
Wrapper closure and lint-suppression guards 23 cases passed at 86e56cd; the three lint-suppression cases passed again for the final withdrawal. Its signatures/imports are unchanged.
node scripts/check-changed.mjs Last full-candidate run at 86e56cd stopped at 456 environment names versus budget 455; candidate and exact base had identical sets. All seven affected static gate commands passed separately. Local dead-export production/full-tree scans remain missing proof as detailed below.
Production/test types, touched-source lint, runtime cycles and Madge Final withdrawal: production types, agents-root test types, file lint/format and both cycle checks passed. Runtime cycles: zero; Madge: zero, matching the pinned clean base. All four affected test graphs, full touched-source lint/format and assertion ratchet passed at 86e56cd; remaining source is unchanged.
Canonical plugin SDK API comparison Comparison of 2dd328a → 86e56cd completed in 2,612.968 seconds: 149 affected exports (148 reachable changes, one private class declaration change), zero entrypoint/export additions or removals. The nine declaration deltas and optional-undefined TLS domains were independently reviewed; no new supported contract difference was found. Acknowledgement 6793abc7 belongs to that exact comparison. The final withdrawal changes neither exports nor signatures.
Affected focused tests At 86e56cd, all 21 exact affected targets passed: 344 cases, no skips, 1,815.814 seconds. The final withdrawal passed all four targets / 45 cases with no skips in 759.516 seconds, covering workdir delegation, environment errors/hooks and lint suppressions.
Broad ordinary agents selection on b670173 All 2,048 selected files accounted for across 20 configurations: 2,009 passed, 30 failed, nine skipped. Cases: 26,568 passed, 65 failed, 69 skipped, and three native dot-marked cases (not passing execution). Exact manifests reconcile with zero missing/unexpected paths or count mismatches. Both invocations exit 1; combined wrapper wall time 63,259.565 seconds. Failures are qualified below.
Historical hosted CI Prior-head CI completed for 16b51479c24ceaa236976083af2604bf2453e416: seven failed test jobs plus the aggregate; zero cancelled checks. The precise changed-path scan passed. The coordinator authorized the subsequent conflict repair and parity work described above. The completed first attempt belongs to 86e56cd; its failed jobs are recorded below. The zero-step cancelled Auto response job was rerun and passed under the earlier instruction. No old-head result is claimed as current-head hosted proof.
Historical 16b5147 head: all failed jobs and then-current landing blockers

Current run 38105112899 tested merge b2a9ae9e474d9542c066db2276bc544c26acf097, whose parents are main 5ff4d101c72d7561acd0f7f4cd66f8ea1de69bb8 and head 16b51479c24ceaa236976083af2604bf2453e416. The exact merge object and parent identities were fetched and verified. The final check-run census contains 120 successes, 50 scope skips, eight failures and one neutral result, with no pending or cancelled check runs. The separate security-sensitive and dependency-review statuses are successful; the CI-gate status is failure.

Current failed job Evidence and disposition
Compact small 18-2 Text-end reconciliation emits \nSecond instead of Second. Exact-source inspection locates main commit 3666e847: empty-group filtering loses the separator in the synthetic prefix, leaving the consumed offset at five instead of six. P3 substitutes an identical fresh-state factory in this owner; its changed chunking branch is bypassed. The file is nevertheless touched by P3, and clean-main runtime proof is absent: no strict waiver is claimed.
Compact small 19-4 Workspace bootstrap publication resolves true where the fixture expects hard-link failure. CI main includes fs-safe 0.26 from 626eeac / #168629: verified upstream source intentionally catches ENOTSUP and publishes through an exclusive placeholder plus rename. This source explanation is not independent post-upgrade baseline execution. No contract, dependency or assertion is changed here.
Compact small 4 Sandbox seed publication likewise resolves instead of rejecting after injected ENOTSUP. The same intentional fs-safe 0.26 fallback explains the observation; post-upgrade baseline execution remains missing. Top-level workspace read-result cleanup is separate from the unchanged publication operation, but no blanket no-overlap exception is claimed.
Extensions bundle 6 All 30 Discord draft-final failures match the saved unrelated PR #168483 run 38092712422 / job 114340510754, including the missing registerSessionBindingAdapterV2 mock export. The new merge/base blobs preserve that mismatch; eight relevant paths and the failing stack contain no P3 edits. Independently attributed for this job.
Compact small 1 Same zero-call cursor assertion at line 115, independently reproduced on scheduled main 38101298609 / job 114357727405. Exact test/lifecycle blobs match the new CI base. The fixture's promptError: true triggers the upstream early return before recording; P3 changes neither owner nor test. Independently attributed for this job.
UI E2E 5/7 All three task-suggestion viewport failures match scheduled main 38103250398 / job 114363496384 at 7cc1ca64798cf9897b3f27e1751ae2a8e73d462d. Main bb7c69ddd04 moved Details into the header while the test retained its gutter selector. The failing test and seven relevant UI/fixture owners match the tested base and are untouched by P3. Independently attributed for this job.
Extensions bundle 4-1 The same six steering cases and two suite errors recur: the acceptance callback is absent, another case times out, teardown exceeds its deadline, and four following same-store cases report admission closing. No matching independent sequence was established; changed redaction is on the wider persistence path. First cause, cross-file causality and strict waiver readiness remain unresolved.
CI aggregate Fails because the selected UI E2E and Node-test groups fail. Preflight, security-fast, build, type/lint, ratchet and additional-check groups passed. It creates no additional exemption.

Main subsequently advanced into a content conflict in src/agents/prepared-reply-dispatch-runtime.ts. The coordinator explicitly authorized its repair and sequential parity proof; the current candidate above supersedes this blocked historical state. No source failure was hidden with retries, timeout increases, skips, assertion weakening, or new suppressions.

First hosted attempt: exact-head failures and dispositions

These results belong to 86e56cd, tested through merge 2097608f44d968f7697a8a83e7591204e0bbf15a with main 76a1a8043866891d4bdeca57599ea68bc0e7f845. They are not final-head results. All check runs were enumerated; no cancelled job remained after the Auto response rerun.

Failed job Disposition
Precise changed-path scan Two findings in the touched exec-preparation file identify inherited Git-environment lookups. The final follow-up withdraws this file's three-line cleanup entirely, preserving exact base bytes and leaving scanner/rules unchanged. Fresh scan proof is required on the new head.
UI E2E 1/7 Chat-panel geometry/focus case timed out waiting for the primary region to hide. That case passes on scheduled-main runs 38095292949 and 38101298609; those passes do not fix or attribute the failure. Direct UI owners are unchanged, but a changed CSP helper executes in fixture setup. No inherited exemption is established.
Extensions bundle 6 All 30 Discord draft-final failures reproduce on unrelated PR #168483, run 38092712422, job 114340510754: main migrated the binding manager to V2 while the fixture mock exports only V1. No P3 change lies on the failing path. This is evidence for this job alone.
Compact large 20-1 All 70 canonical-descendant case failures match scheduled main 38095292949, job 114340368611, including initialization-binding and rollback-owner errors. Direct stacks are unchanged, but setup executes changed transcript-redaction code; strict no-overlap waiver readiness is not established.
Compact small 9 Cursor recording expects one call but receives zero. Upstream af82e00296d added a fixture with promptError: true; e52cbaafcca moved the failed-turn return before recording. Exact failure reproduced on scheduled main 38101298609, job 114357727405, at 5cdfc2f; relevant blobs match and P3 changes neither owner nor test.
Extensions bundle 2 AgentsAPI persistence: 17 failures comprising 11 whole-case timeouts, three shared-state owner errors, one resulting error-identity assertion and two unknown-outcome errors. The first delete timeout is unexplained; later contamination is plausible but unproved. No matching independent failure was established.
Extensions bundle 4-1 Six failed cases and two suite errors across two Codex steering files: queue-accepted callback absent, a whole-case timeout, teardown deadlines, and subsequent admission-closing errors. First-cause and cross-file causality remain unresolved; no blanket database-retirement attribution is claimed.
CI aggregate Failed because the selected UI E2E and Node-test groups failed. Preflight, security-fast, build, type, lint, ratchet and additional-check groups passed. This aggregate supplies no separate exemption.
Prior-revision proof and integration review

These results belong to preceding candidates and do not establish final-head success:

  • Production core types, all 27 core-test type shards, touched-source lint, and the full canonical build passed before the later integrations. The build included protocol generation, declarations, plugin exports and UI. The two explicit E2E files passed 146 cases.
  • Runtime value cycles were zero; Madge found zero components on the compared candidate and captured main.
  • SDK comparison reported 149 affected exports: 148 reachable declaration changes and one private class declaration change, with no entrypoint/export additions or removals. Independent review found no supported contract difference, including the retained optional-undefined TLS domains. The 1cb9b5a/8cb103b comparison completed in 3,334.066 seconds with acknowledgement 57ed5337; that acknowledgement is historical only.
  • Differential probes passed 3,112 mode/keybinding/theme calls, 448 proxy/schema cases, and 43 MCP lifecycle cases.
  • On 8cb103b, production types and touched-source lint passed. Core-test types passed 26 of 27 graphs; the Gateway error is recorded separately below. Its first focused run passed 199 cases and failed the scoped-refresh case reproduced on its base. The subsequent completion selection executed all 237 exact targets across 13 configurations: 236 files passed and one failed; 4,429 cases passed, one failed, and five were skipped in 4,908.329 seconds. The sole failure was the reused-exec_0 case. Its wrapper aggregate does not mean 13 failed configurations.
  • The sole changed test, code-mode-swarm.lazy.test.ts, passed through the native one-worker wrapper: 250.6 seconds wall time, including 132.7 seconds worker preparation and 76.1 seconds case execution. It retains all assertions. Hosted CI timing is not yet available.

The final review's two duplicate findings alleged that unconditional applyAgentConfig overwrites existing agents. The unchanged earlier guards throw for a non-bootstrap duplicate and return unchanged configuration for recovery or authored/persisted bootstrap state. Reaching the call with an existing entry therefore proves the deleted injected-bootstrap predicate. The findings were rejected on that complete control flow; source remained unchanged.

Local failures reproduced on captured main

These are matching local observations on the stated baseline, not fixes or automatic exceptions for a later hosted job. Each final-head failure still requires its own attribution.

Failure Matching baseline evidence and limit
code-mode-retention.test.ts: completed-input/frontier retention deadline The matching full unit-fast selection on clean d719f09 reproduces the approximately 15-second deadline. A narrower pass does not erase either failure.
code-mode.failure-phase.test.ts: guest settlement of a tool call (reject: false, parked: false) Clean d719f09 reproduces the pre-dispatch QuickJS timeout in the matching isolated selection.
code-mode.output.test.ts: unsettled calls with clipped output Clean d719f09 reproduces the status assertion in the matching isolated selection. This does not attribute the separate guest-phase metadata failure.
prepared-model-catalog-worker.secrets.test.ts: credential inspection deadlines Clean d719f09 reproduces the six candidate deadline variants: config literal, marker, env-template, loader-substituted literal, loader-escaped literal, and profile-only sibling. Main also times out in the pending-shorthand case, but candidate's spawn EBADF there is a different failure retained below.
worktrees/service.gc.test.ts: large Git-index collection and edit restoration Clean d719f09 reproduces the deadline. No worktree contract or timeout was changed.
embedded-agent-runner/compact.delegate-resources.test.ts Clean-main original-order execution reproduces the abort-after-commit timeout followed by the provider-tail database-ownership failure. Preserve this pair and its order.
cli-runner.reliability.test.ts: direct caller fresh retry without a pre-clear hook Clean 1cb9b5a reproduces FailoverError: session expired, with 55 other cases passing. The fixture freezes Date while recovery uses monotonic time; this predates the lane. The log does not measure elapsed budget at the guard, and no fix is claimed.
prepared-model-runtime.scoped-refresh.test.ts: two expected worker calls, three observed after credential removal Clean 1cb9b5a reproduces the exact assertion with 19 other cases passing. The relevant policy owners/test are byte-identical. The final base changes this contract upstream, and its focused suite passed on the final head.
Gateway core-test type graph Clean 1cb9b5a reproduces TS2345 at untouched src/gateway/control-ui-public-session-refresh.test.ts:51 for a possibly undefined regex capture. The final-head Gateway test-type graph passed after the upstream integration.
openclaw-tools.media-factory-plan.test.ts: deferred PDF resolution/active model Clean 2dd328a reproduces the same non-vision assertion at line 414, with nine other cases passing. The resolved result is unsupported_pdf_reference; it passed the no-model guard, but the selected model/provider is not identified. Direct owners and test are byte-identical. No fix is claimed.
agent-bundle-mcp-runtime.test.ts: concurrent catalog loading and in-progress connections after invalidation Whole-file clean 2dd328a execution reproduces both empty-fixture-log assertions at the same await boundaries; 55 cases passed. The other two failures differ and remain below.
code-mode.wait.test.ts: concurrent waits Whole-file clean 2dd328a reproduces the setup assertion at line 542: failed instead of waiting before either wait call, 523 ms versus candidate 517 ms; 29 other cases pass. Underlying error phase is unprinted; the concurrent-wait guard is not reached.
worktrees/service.removal-budget.test.ts: missing-object snapshot backoff Original-order whole-file d719f09 baseline reproduces the 120-second whole-case timeout (134.134 seconds versus candidate 122.792). Twelve other cases pass, including the intervening cancellation case. The precise stalled phase remains unknown; worker preparation separately took 609.459 seconds.
Environment-name budget Final candidate and exact 2dd328a base have an identical native-collected set of 456 names against budget 455. The unchanged check remains enabled; the lane does not raise its budget.

Earlier static failures—a stale size entry, an extra suppression in an untouched sessions fixture, and two unused Gateway exports—were also reproduced on captured main and then fixed upstream. The integrations retain those fixes without lane-authored changes to those owners.

Unresolved local failures and incomplete proof

Source review found no established causal lane regression for the investigated cases, but does not prove performance equivalence. Passing baseline replays and failures at different boundaries do not establish inheritance. No assertion, timeout, retry, skip or budget was weakened to hide these observations.

Observation What remains unresolved
code-mode.output.test.ts: direct metadata on guest timeout Candidate returned failurePhase: host instead of guest; the remaining metadata assertions were not reached. Clean main passed this case. Existing shared-budget expiry before worker progress publication is a supported hypothesis, not attribution.
code-mode.bridge.host-denial.test.ts: no-start gateway, auto-sandbox, required-missing and required-outside (four cases) Returned host/false rather than bridge/true at the dispatch assertion. Failure before dispatch is observed; the omitted code does not prove timeout. Main passed these cases.
Same host-denial file: final hook veto/throw and approval timeout/report (four cases) Expected hook was never called. The intended veto/throw/approval behavior was not reached; phase and error code were not printed. Main passed these cases.
Same host-denial file: approval allow-always Candidate's corrected invocation returned outer failed. Main failed the same assertion with outer completed and inner running, a materially different result. This is not an exact reproduction.
Same host-denial file: cancellation-ignoring preparation Outer 120-second test timeout; the blocked await is unknown. Main passed. A missed hook-entry signal is plausible but not established.
code-mode.bridge.lifecycle.test.ts: consecutive responses reuse exec_0 Rebased candidate recorded host timeout, bridgeDispatchStarted: false, and zero calls. Main passed. This failure occurred before the nested-activity behavior could be asserted.
prepared-model-catalog-worker.integration.test.ts: in-flight/cache identity Candidate's subsequent cached read changed from four to seven rows, with native fields, in two runs. Main passed. Partial publication followed by native completion is source-consistent but unproved.
prepared-model-catalog-worker.secrets.test.ts: loader-pending shorthand Candidate observed spawn EBADF; main's credential deadline is not the same failure.
prepared-model-catalog-worker.metadata.integration.test.ts: canonical metadata ownership Candidate returned only sqlite-model where the discovered plugin-generation-v1 row was expected. Earlier ownership assertions passed; later discovery-marker assertions were not reached. An early static return is possible. Final base changes native demand, so no old-boundary reproduction or fix is claimed.
prepared-model-catalog-worker.chat-metadata.integration.test.ts: 64-agent fixture Exceeded the 120-second whole-test budget (125.224 seconds reported). No failed work-bound assertion or timed-out phase is identified. This is not demonstrated unbounded roster work.
agent-command-local.test.ts: static capabilities (empty, authored, replace, generic, explicit off) All five failed. Empty has a confirmed 60-second child termination with no JSON output; the other four failed parsing missing/incomplete stdout near that deadline. Their individual termination phase is unknown. No matching baseline proof is established.
agent-bundle-mcp-retention.test.ts: memory-session runtimes across shared-worker files Earlier broad run reports nested wrapper exit 143 after its 120-second no-output watchdog, 175.609 seconds overall. This is not the separate reproduced Code Mode retention deadline. Preparation remained unresolved when the nested wrapper aborted it; the precise stalled stage is unknown. Earlier main outer-timeout evidence is a different failure. Retention proof is missing; no fix or exact main attribution is claimed.
agent-bundle-mcp-runtime.test.ts: healthy sibling missing and retirement startup Candidate omitted healthyServer from the first catalog (2.089 seconds) and settled before slow.log recorded initialize (2.022 seconds). Whole-file main failed those cases at different boundaries: outer 120-second and eight-second test timeouts. These are not exact reproductions; startup latency is a supported hypothesis, not established attribution.
openclaw-tools.session-status.gateway-model.test.ts: original operator policy and unrestricted callers Earlier broad run reports operator source identity changed; start a new request. The nested cause is UserProfileNotFoundError during initial authority capture, before the failing invocation enters its tool callback. The captured catalog is current but does not resolve the profile to its expected canonical ID. The log does not identify which invocation failed, so earlier model selections may already have run. Direct owners are unchanged, but modified catalog dependencies remain reachable. Whole-file pinned-main execution passed all nine cases in 231.070 seconds. That narrower pass does not establish a fix or inheritance; the cause of the canonical profile mismatch remains unknown.
worktrees/service.removal-budget.test.ts: persisted timeout backoff Candidate exceeded the unchanged 120-second whole-case limit (138.340 seconds). Original-order d719f09 baseline passed this case in 117.054 seconds; this does not establish a fix or inheritance. No stalled phase or individual Git timeout is identified.
auth-profiles/oauth-refresh-fence.test.ts: adoption after forced refresh failure The fixture table captures ten-minute expiry values at test registration; createCredential(candidate) preserves those old values. Preceding sequential case durations already exceed ten minutes before adoption. The unchanged freshness check rejects them, preventing adoption and adopted-key construction; therefore the wrapper's cause is the original forced-refresh error instead of the expected aggregate. Source and fixture are identical across base/candidate/new base. This pre-existing fixture-time defect is recorded for the coordinator; no replay or fix is claimed.
subagents/registry/subagent-reset.lifecycle.test.ts: chat requester/controller cleanup Both chat variants exceeded the unchanged 120-second whole-case limit (125.737 and 126.355 seconds); later RPC cases pass. Setup alone contains 23 awaited operations, with no marker identifying the stalled phase. Direct owners are unchanged; source review found no causal lane change. No matching baseline or fix is claimed.
worktrees/service.gc-performance.test.ts: cold inventories across registry reopen The case timed out at 130.620 seconds against its 120-second limit. The emitted metrics cover only two of six GC calls, excluding setup, database close, later reads/assertions, and later GC work; counted spawns exclude maintenance calls. They do not locate the timeout phase. Worktrees owners are unchanged, and no direct lane cause was found. No baseline reproduction or fix is claimed.
auth-profiles/oauth.concurrent-agents.test.ts: copied refresh generation ownership The first case exceeded its explicit ten-second deadline (15.826 seconds); later cases use a 120-second default. Its credentials are created inside the case with one-hour expiry, so the earlier collection-time defect does not apply. Direct owners are unchanged; the stalled phase remains unknown, with no replay or fix claimed.
cli-runner/prepare.command-continuity.test.ts: new, published, and explicit-false requesters Three consecutive preparation/persistence/cleanup cases exceeded the unchanged 120-second limit (124.857, 123.103, 125.572 seconds). They do not execute native CLI inference. The following automatic-binding case passes, but does not resolve them. Direct owners are unchanged; transitive review identified no cause, and there are no phase markers or matching baseline runs.
sandbox/sdk-state-owner.process.test.ts: foreign-owner and standalone SDK behavior Its child missed a 100-second guard while live and emitted ready plus seven replies through successful offline-on calls. Output collection continues during diagnostic grace after callbacks stop, so the last reply cannot locate the parent's unfinished phase. Reports provide no named deadlock cause. Direct owner files are unchanged, the CSP normalizer has no call in this flow, and broader causal independence remains unproven. No replay or fix is claimed.
main-session-recovery-state.terminal-residue.test.ts: terminal-only custody The case exceeded its 120-second whole-case limit (120.050 seconds). Setup writes, discovery/marking, verification, and awaited cleanup have no phase markers. Direct owners are unchanged; P3's changed checkpoint helper is not called by this marking path. No baseline reproduction or fix is claimed.
sandbox/docker.config-hash-recreate.test.ts: retained registry custody The Docker variant exceeded its 120-second whole-case limit (120.286 seconds), followed by Podman rejecting with container name is already in use (65.947 seconds). Container commands are mocked; real registry work and cleanup remain in the timed span. No markers identify the timeout phase or establish a relationship between the failures. Direct owners are unchanged; no replay or fix is claimed.
subagents/spawn/acp-spawn-resume.worker.test.ts: resume ownership The case exceeded its 120-second limit (120.772 seconds) across nineteen seed scenarios, an ownership matrix, six gated manager races, and cleanup. No phase marker or failed ownership assertion is logged. Direct owners are unchanged and source review found no concrete lane cause. No baseline or fix is claimed.
subagents/spawn/subagent-capabilities.store.test.ts: explicit-store requester policy The explicit-path variant exceeded its 120-second whole-case limit (122.541 seconds). The span includes real upserts, projection setup/materialization, fifty observed reads, updates, and cleanup. No failed SQL/policy assertion or stalled phase is logged. The default-store pass is a different variant; direct owners are unchanged, with no replay or fix claimed.
extensions/codex/src/app-server/session-history.test.ts: durable item-limit capture diagnostic On original b670173, the 95.663-second case expected item_limit but logged history_read_failed; incognito item-limit and both field-limit variants pass. Unknown thrown errors or rejected worker results can produce that generic reason. The durable worker path has a 60-second request limit, but whole-case elapsed time does not prove it fired. The underlying exception is not logged. No matching baseline or fix is claimed.
Same history file: oversized incognito projection The case exceeded the unchanged 120-second whole-case limit, reporting 159.468 seconds. Its non-incognito counterpart passed in 21.598 seconds. Fixture writes, admitted reads, projection and cleanup share the timed span; no phase marker identifies the unfinished operation. The actor-bound incognito reader and durable worker paths differ. No causal link to the diagnostic failure, matching baseline, or fix is established.
Same history file: non-oversized prefix revalidation Four consecutive variants timed out at the unchanged 120-second limit: rewrite (120.239 seconds), append (120.960), other-session (121.055), and foreign-rewrite (120.557). The fixture resolves its read-finished barrier only after an intercepted projection worker call fulfills; rejection can leave that barrier pending. The log does not prove that path or a causal chain from the preceding timeout. The final head retains the test/redaction bytes but incorporates upstream fixture, async target-resolution, SDK-reader and storage-owner changes, so full owner-chain equivalence is not claimed. All six history-file failures remain earlier-head observations.
Native dead-export scans Script scan passed; production and full-tree scans reached the unchanged 600-second limit, including sequential use of the same runner. No findings were emitted, but those scans are missing local proof. Exact-head hosted checks must supply it.
Broad validation scope Full selection completed on earlier b670173; it is not final-head broad success. Remainder: 1,601 files, 64 failed cases, exit 1, 62,192.662 seconds. The separate initial 447-file invocation had one failed case. Final-head SDK/static/focused proof is complete; hosted CI remains pending.
Deep coverage and the under-1,000-line exception

Revisited retained and partial candidates, swept remaining top-level production files largest-first, and inspected the authorized adjacent owners. More than two hours of actual implementation/review preceded this disposition. The audit covers 903 top-level production files / 172,713 baseline lines plus 87 adjacent production files / 18,465 baseline lines: 990 files / 191,178 baseline lines. Independent ownership/count reconciliation found no missing or duplicate allocation. Final-head measurement supersedes earlier draft counts.

Responsibility Net production lines removed
Model/auth/catalog and runtime plans 195
Tool policy, rendering, schemas and utilities 127
Exec and interactive modes 157
Runtime assembly, identity, completion and events 232
Code Mode and runtime helpers 60
Transcript, prompts and compaction 39
Bundle/MCP and compaction hooks 30
Context and recovery 45
Workspace and file tools 29
Total 914

Measured alternatives are documented in the per-file coverage: bootstrap-record consolidation initially grew three lines; a patch-ending projection saved zero; a catalog read closure was withdrawn to retain the approved SQLite worker owner; broader provider object-rest projections were withdrawn to retain exact fields and evaluation behavior. Remaining paths retain distinct authority, privacy, normalization, streaming or lifecycle contracts. Tests, fixtures, support and generated output do not count toward the reduction.

@clawsweeper

clawsweeper Bot commented Oct 11, 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 docker Docker and sandbox tooling agents Agent runtime and tooling size: XL labels Oct 11, 2026
@steipete
steipete marked this pull request as ready for review October 11, 2026 00:58
@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: d6012fa46f076da0a5df6d4634bd33f053a19e71
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/agent-tools.policy.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/auth-health.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/bash-tools.exec-approval-followup.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/bash-tools.exec-approval-output.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/exec-auto-reviewer.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/mcp-oauth-store.mutations.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/mcp-oauth-store.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/model-auth-availability.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/model-auth-provider-config.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/model-auth-provider.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/runtime-plan/prepare-auth.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/runtime-plan/resolve-auth.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/sandbox-host.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/transcript-redact.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR shares repeated agent runtime operations within their existing owners while preserving behavior.

Example: A noninteractive node exec request requires approval for git status.

  • Before: The node owner constructs an approval-required failure result inline.
  • After: The shared result builder returns the same failure status and denial text.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful consolidation with substantial static and harness validation; unresolved current-head CI attribution limits confidence despite no established introduced defect.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored internal refactor is outside the ordinary contributor runtime-proof gate, and inspection found no material authority-chain change requiring additional proof.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Repeated runtime operations make maintenance more error-prone; users should retain the same behavior.
Reason: The maintainer-directed change removes duplication within existing owners without adding product surfaces or changing supported behavior.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this PR open: it is a useful maintainer-directed consolidation, and source review established no introduced defect.

Priority: P3
Reviewed head: d6012fa46f076da0a5df6d4634bd33f053a19e71

Before merge

  • Complete next step - Attribute the current-head hosted Codex steering failure against the matching baseline sequence, repair any demonstrated diff-caused defect, and resolve the required CI gate without weakening assertions or retrying merely for green.

Findings

None.

Provenance

  • Uncovered older transcript and registry history: original intent not found (unknown: Extended git blame and git log -S encountered unavailable historical blobs; the inspected refactor retains the existing operations and guards.)
Agent review details

How this fits together

Agent runtime owners consume prepared configuration, credentials, session context, and tool requests, then produce provider requests, execution results, streamed messages, and settled lifecycle state.

flowchart TD
  A[Gateway or CLI request] --> B[Prepared agent runtime]
  B --> C[Model and auth owners]
  B --> D[Tool and approval owners]
  B --> E[Identity and workspace readers]
  C --> F[Provider and tool execution]
  D --> F
  F --> G[Transcript and stream processing]
  G --> H[Reply and lifecycle settlement]
Loading

Technical review

Best possible solution:

Retain the smaller shared operations with existing authority, replay, and storage contracts intact.

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

This is a refactor rather than a reported product bug; source inspection verified the central equivalence claims, and no target code was executed during this review.

Is this the best way to solve the issue?

Sharing repeated operations inside their existing owners is appropriate, and the inspected changes preserve policy precedence, lifecycle ordering, and caller-visible results.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 90f04bfb10df.

Provenance checked

  • Identity and avatar worker/cache lifecycle keeps the original intent (4e4473b: Prepare bounded identity and avatar snapshots in workers after fresh file admission, preserving containment and cleanup.)
  • Exec approval commitment and revocation keeps the original intent (9b1c36d: Revalidate current authorization during serialized approval commitment and before execution, preserving revocations and concurrent grants.)
  • MCP OAuth persistence and leases keeps the original intent (65bc5f6: Keep acknowledged OAuth persistence and live lease authority with the existing state workers.)
  • Model route intent and authentication precedence keeps the original intent (8b5fa24: Preserve explicit authentication pins and subscription billing intent across primary and auxiliary model selection.)
  • Failover classification keeps the original intent (145ec37: Keep shared classification tables and precedence in one substrate with provider hooks consulted consistently.)
  • Stream chunk and paragraph boundaries keeps the original intent (14d272d: Preserve streamed reply boundaries without replaying code; the inlined break handling retains the same source consumption and fence reopening.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 4e4473b adds src/agents/identity-file-runtime.ts:2 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4e4473b4639c; files: src/agents/identity-file-runtime.ts)
  • Ayaan Zaidi: Raw commit 76a1a80 adds src/agents/prepared-model-runtime.facts.ts:449 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 76a1a8043866; files: src/agents/prepared-model-runtime.facts.ts)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Production versus test LOC Production +1,624/-2,540; tests +0/-1 The pinned introduction removes 916 net production lines through consolidation; the test deletion removes an unused argument without weakening assertions.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: Behavior-preserving runtime cleanup has maintenance value without an established urgent user-facing regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (8 earlier review cycles)
  • reviewed 2026-10-11T01:07:46.482Z sha 86e56cd :: needs changes before merge. :: none
  • reviewed 2026-10-11T01:20:33.297Z sha 86e56cd :: needs changes before merge. :: none
  • reviewed 2026-10-11T02:33:41.332Z sha 16b5147 :: needs changes before merge. :: none
  • reviewed 2026-10-11T02:45:19.071Z sha 16b5147 :: needs changes before merge. :: none
  • reviewed 2026-10-11T03:50:02.262Z sha 16b5147 :: needs changes before merge. :: none
  • reviewed 2026-10-11T06:24:52.380Z sha cc8ee8e2c2628c847c628dac331469ec8a6ceb38 :: needs changes before merge. :: none
  • reviewed 2026-10-11T06:33:58.110Z sha cc8ee8e2c2628c847c628dac331469ec8a6ceb38 :: needs changes before merge. :: none
  • reviewed 2026-10-11T07:57:58.245Z sha d6012fa :: needs changes before merge. :: none

Reviewed October 11, 2026, 4:30 AM ET / 08:30 UTC (Revision 9).

@steipete
steipete force-pushed the deslop/d31-agents-toplevel-p3-20261007 branch from 16b5147 to cc8ee8e Compare October 11, 2026 06:14
@steipete
steipete force-pushed the deslop/d31-agents-toplevel-p3-20261007 branch from cc8ee8e to d6012fa Compare October 11, 2026 07:48
@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head CI disposition for d6012fa46f076da0a5df6d4634bd33f053a19e71.

Run 38122624811 is complete. Every check run was freshly enumerated: 123 success, 56 scope skips, four failures, one neutral; no pending or cancelled checks. Dependency review and security-sensitive review are successful. The failures below are inherited; failed CI is not being relabelled green.

Failed job Evidence
large-16: Gateway fixture server.sessions.fixture-lifecycle.test.ts cannot read the nested fixture's worker.pid; its unjoined-fixture/resource-claim errors follow that missing receipt. Clean main f2e649da67fa909126980d88171e93f3f99d6f01 reproduces the same case, missing PID and cleanup sequence. The PID would be written before Gateway imports; the failing fixture/configuration owners are not lane changes.
large-14: stopped artifact inspection sessions-files.repository.test.ts expects a tampered blob rejection but receives the original verified content. Main #168921 changed reads to git cat-file --batch; the old fixture injects only for cat-file blob, so it never tampers. Clean main 43c68c34df71bed694fc4b1de0725f5e7495b8c1 reproduces the exact assertion in the complete file (11 passed, one failed). Test, handler and blob readers match the CI base and are untouched by this PR. Independently reproduced and repaired by #168975, already on current main.
extensions-4-1: Codex steering An isolated Linux comparison reproduces all 168 case outcomes and the complete detailed failure section on both clean main 43c68c34df71bed694fc4b1de0725f5e7495b8c1 and this exact head. The same ten files run sequentially in one secretless Linux arm64 container, Node24.19.0, two CPUs, 8GB, two workers. Only ANSI/report formatting and temporary database paths were normalized when comparing failures. Within-file order matches; cross-file completion order differs.
CI aggregate Derived from the three test jobs above, with no additional failure. Build, production/test types, lint, guards, all seven UI E2E jobs and the other selected test jobs passed.

The Linux main output is:

Test Files  2 failed | 8 passed (10)
Tests       6 failed | 162 passed (168)
D31_PARITY_END main exit=1

The Linux candidate output is:

Test Files  2 failed | 8 passed (10)
Tests       6 failed | 162 passed (168)
D31_PARITY_END head exit=1

Both detailed failures match hosted CI: settlement acceptance at line217 receives zero callbacks instead of one true; its cleanup times out at 180 seconds. The completed-answer case hits its 120-second test timeout and 180-second cleanup timeout. Four subsequent cases report the same closing-database admission errors. Settlement afterAll and steering lifecycle-deletion errors also match. This supplies the missing Linux-main reproduction; the earlier passing macOS runs do not prove the Linux issue fixed. The queue, source-authority and cleanup owners are unchanged. The exact blocked persistence sub-operation remains unproven; no guessed deadlock fix or relaxed test is included.

The owned Docker container was stopped and removed after collecting both results. No remote lease was allocated. No timeout, retry, skip, assertion, scanner rule or fixture was weakened.

The lane removes 916 net production lines (+1,628/-2,544 across 130 production files). The complete local changed-check sequence passed. The final conflict-free rebase leaves all six lane commits patch-identical and every lane production file byte-identical to that validated revision; current core types, runtime cycles (zero), Madge (zero), and lint-suppressions passed. SDK comparison/review found no supported contract change (acknowledgement 2bb4f9fc, retained with its exact original base/head).

@steipete
steipete merged commit ea1e27e into main Oct 11, 2026
191 of 196 checks passed
@steipete
steipete deleted the deslop/d31-agents-toplevel-p3-20261007 branch October 11, 2026 09:17
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…claw#168770)

* refactor(agents): share remaining runtime projections and lifecycle paths

* refactor(agents): retain the catalog transaction query owner

* refactor(agents): preserve narrowed result and wait types

* refactor(agents): preserve resolved TLS optional value types

* refactor(agents): tighten shared worker and catalog contracts

* refactor(agents): retain exec environment preparation
RomneyDa pushed a commit that referenced this pull request Oct 14, 2026
)

* fix(context): context budget falls back to 200k for bundled provider models in cold sessions

* fix(context): context budget falls back to 200k for bundled provider models in cold sessions

* fix(context): context budget falls back to 200k for bundled provider models in cold sessions

* fix(context): preserve discovered context provenance

* fix(memory-flush): keep server compaction threshold resolution synchronous

* fix(context): keep authored config windows non-sticky on ownership ties

* fix(context): drop the test-only parallel budget resolver

The exported flush window resolver was reachable only from its own
tests, so the bundled cold-budget fallback could regress in production
while the suite stayed green. Remove the helper and cover the bundled
catalog windows through runMemoryFlushIfNeeded, the actual maintenance
boundary that feeds resolveMemoryFlushPlan.

* fix(sessions): context window shows 200k for plugin-discovered models

Embedded runs labeled every run-level context window as legacy resolved, which cold session projections intentionally distrust, so sessions list and /context fell back to the 200k default when synchronous catalog lookup could not see the model. Carry the resolution source from run preparation and persist model- or config-resolved windows as resolved-v1; the generic default keeps the legacy marker.

* fix(sessions): clarify context provenance comment

* fix(agents): let accepted discovery replace synthetic context fallback

Related: #156635

* test(agents): cast override fixture config through unknown

* fix(github-copilot): keep a missing /models native window synthetic

When Copilot /models omits or reports an invalid max_context_window_tokens,
the mapper filled in the 128k default as if it were a reported native
ceiling. With a real max_prompt_tokens present, that fabricated window
became authoritative and could both clamp the prompt limit and grant
replacement authority over the synthetic fallback.

Mark that default with the same contextWindowSource: "synthetic"
provenance used by the unknown-model branch, never let the estimate sit
below a real prompt limit, and thread the marker through the provider
result copy, persisted catalog schema, model registry and config merge.
Authored contextWindow/contextTokens clear the marker. Supersession now
requires a reported limit: a real prompt limit, or a non-synthetic native
window. A genuinely reported 128k window is unchanged.

Reported-by: snotty <[email protected]>

* fix(sessions): recover synthetic 128k session capacity from its admitted owner

An existing session whose persisted telemetry came from the synthetic
128k fallback stayed at 128k after discovery until a later run, because
the projector trusted it as runtime telemetry and took min(persisted,
resolved).

- Embedded runs stamp contextTokensSource: "synthetic" when the prepared
  budget is exactly a provider unknown-model estimate (no reported prompt
  limit, authored cap, modelsConfig sizing or narrower caller budget),
  including failed/cancelled attempt metadata.
- Synthetic rows are never trusted telemetry, including locked sessions.
- /status and session_status bind the displayed session to its admitted
  prepared owner (agent + spawned workspace) before choosing capacity. A
  synthetic row takes that owner's accepted capacity (or an authored cap).
  An unbound, retired, failed or model-less owner settles as owner-scoped
  unavailable and renders unknown, never the stale estimate or another
  owner's process-global cache value.
- Genuine (non-synthetic) persisted 128k stays conservative.

* test(proof): add redacted patched-Gateway capture for #156636

Adds a human-run procedure and script that capture /status and
session_status context lines from a patched scratch Gateway for a fresh
session, existing-session recovery and an account switch. Output is
redacted (tokens, IPs, phone numbers, emails, private endpoints, paths,
account/session ids) and the script never starts a Gateway, writes
config or reads credentials. --self-test exercises the redaction rules.

* fix(sessions): keep authored context windows out of resolved-v1

Authored models config windows and caller budget caps are removable operator config. Persisting them as resolved-v1 let cold session projection keep publishing a cap after the operator removed it.

* fix(sessions): keep selectable context windows out of resolved-v1

A model that declares context-window options sizes its budget from the session's window selection (or the declared default). The cold session reader matches resolved-v1 rows only by provider, model, and harness, so a persisted 200k selection could outlive a later switch to 1m, and the reverse. Keep those budgets on the legacy resolved marker.

* test(agents): move context provenance cases to a sibling e2e file

embedded-agent-runner.e2e.test.ts is over the line cap, and the line-cap ratchet rejects any growth there. The provenance cases only need the fast-run mocks, so they live in their own e2e file.

* fix(status): correct stale context limits after model discovery

* test(copilot): use current context cache fixture owner

* refactor(copilot): keep context contracts within owner size limits

* test(agents): consolidate context provenance coverage

* fix: preserve declared provider catalog context windows

* fix: separate configured context constraints from runtime capacity

* test: diagnose native catalog admission failures

* fix: resolve context budgets from current model catalog authority

* test: account for context capacity through the published catalog owner

* fix(copilot): finish catalog publication caller cutover

* fix(context): apply configured budgets across native runtimes

* fix(agents): preserve synthetic context provenance in run metadata

* fix(context): qualify persisted capacity by runtime and account

* test: update media fixture context budget mocks

* test(cron): remove duplicate selection coverage

* fix(status): project context from current session owners

* test(sessions): distinguish unavailable native capacity

* fix(agents): preserve authored caps and compaction provenance

* fix(status): use discovered capacity for current session reports

Keep status, context reports, session listings, and Gateway defaults bound to current model metadata and verified session budgets. Do not clamp admitted display facts to a stale process cache or invent a default denominator when capacity is unknown.

Preserve the original discovery/status fix by @snotty while dropping the independent Copilot accounting stack.

Co-authored-by: snotty <[email protected]>

* fix(sessions): borrow published local gateway capacity

Consume the active local Gateway catalog without starting discovery, and resolve automatic runtime selection before matching a verified saved budget. Keep API capability fallback separate from native capacity and include that choice in the Gateway row memo.

* test(context): use local model capacity fixtures

Keep generic context-report fixtures on the OpenClaw runtime so they do not borrow API metadata for an implicitly selected native harness.

* fix(status): preserve runtime choices and scoped report ownership

Keep additional Gateway runtime capacities in CLI catalog conversion. Resolve summary defaults only through an available agent owner, and keep namespaced transcript model IDs bound to their current provider catalog. Update neighboring regression fixtures to supply admitted metadata or expect unknown capacity.

* fix(sessions): preserve spawned workspace capacity ownership

* test(context): cover captured reporting cache isolation

* test(context): retain contributor cache-isolation coverage

Co-authored-by: Mike <[email protected]>

* fix(sessions): retain offline listing when Gateway inspection fails

---------

Co-authored-by: zhang-guiping <[email protected]>
Co-authored-by: Yigtwxx <[email protected]>
Co-authored-by: saju01 <[email protected]>
Co-authored-by: Dallin Romney <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: snotty <[email protected]>
Co-authored-by: Mike <[email protected]>
(cherry picked from commit 8eefd33)


Backport notes (release/2026.10.5):
- src/agents/context-resolution.ts: conflict only in the configured-token
  early returns, which main had collapsed (ea1e27e, #168770 refactor).
  Kept the branch's two equivalent early returns and took main's
  allowCacheLookup-gated provider cache lookups unchanged.
- src/auto-reply/reply/commands-status.test.ts: main deleted three
  /status cases in ce34a0f (#169092) before this PR landed, so the PR
  never updated them. They still exist on this branch and asserted the
  stale behavior this fix removes. Updated them to the PR's contract, the
  same way the PR updated src/auto-reply/status.test.ts: unknown capacity
  renders "?" instead of the 200k default, a provider-local slash transcript
  model binds to its admitted catalog entry, and an unresolved active
  fallback no longer reuses the caller's live contextTokens.
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 18, 2026
First-parent upstream d9eba8a..facdd3c (13 PRs, including openclaw#168847
reply session coordination, openclaw#168833 Solid MCP apps, openclaw#168770 runtime
lifecycle consolidation, openclaw#168840 Solid settings pages).

Conflict:
- src/auto-reply/reply/commands-system-prompt.ts: upstream dropped the
  try/catch around createOpenClawCodingToolsAsync; took upstream's form
  and re-applied our only delta (buildInventoryContinuationToolOpts spread).

Auto-merged files carrying continuation overlay, reviewed:
- transcript-redact.ts: upstream's sanitizedField restructuring leaves our
  sanitizeTranscriptToolCallBlock projection in front of the walker intact.
- embedded-agent-utils.ts / subscribe snapshot, update, stream-rendering:
  upstream factored createAssistantStreamBlockState; display-text
  sanitization untouched.
- session.ts: upstream's rollover simplification is disjoint from our
  clearReplacedSessionRuntimeState call (continuation reset authority).
- session-updates.ts: upstream dropped the skill-snapshot expectedSession
  guard; our newSessionId/sessionKey compaction projection args kept.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docker Docker and sandbox tooling P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant