Repository navigation
fix: resume interrupted tasks in their original session - #173579
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c6923834ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const fullAccess = | ||
| execPolicy.mode === "full" && execPolicy.security === "full" && execPolicy.ask === "off"; |
There was a problem hiding this comment.
Preserve retained delivery restrictions in full-access checks
When a tombstoned session has a retained delivery constraint such as restartRecoveryDeliveryMediaUrls, restartRecoveryDisableMessageTool, or restartRecoverySuppressTextDelivery, and its exec policy is full/full/off, this marks the resume as unrestricted. The automatic recovery owner explicitly excludes those states from fullAccess in main-session-restart-recovery-store.ts:498-504; omitting the same checks here can bypass restart-safe tools and the CLI fallback, allowing a full-access CLI continuation even though it cannot enforce the retained message/delivery restriction. Include the retained delivery constraints when computing fullAccess.
AGENTS.md reference: AGENTS.md:L71-L73
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f2ec360. In-place recovery now applies the same three retained-delivery checks as automatic recovery before allowing the full-access exemption. Gateway regressions cover media, disabled-message, and suppressed-text constraints: all keep the CLI session tombstoned, preserve its transcript, and admit no input. The complete in-place Gateway suite passes 10/10.
|
Codex review: needs real behavior proof before merge. What this changesThis PR adds explicit recovery that continues interrupted work in its original session while retaining replacement-session recovery. Example: A Gateway restart interrupts work in agent:main:operator-resume-continue.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 8 items remain Keep this maintainer-authored PR open: preserving the original session is useful, but two restart-safety regressions and stale CI assertions need repair. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe recovery RPC validates the interrupted session, prepares a continuation, and sends it through ordinary chat admission; the existing input actor persists that input and clears the recovery tombstone atomically. flowchart TD
A[WebChat Resume] --> B[Recovery RPC]
B --> C[Recovery policy and authority]
C --> D[Chat admission]
D --> E[Session input actor]
E --> F[Agent runtime and tools]
Technical reviewBest possible solution: Continue through the existing recovery and input actors while preserving retained restart restrictions and the public replacement-recovery contract. Do we have a high-confidence way to reproduce the issue? Source establishes both restriction-loss paths, and exact-head CI annotations establish the stale assertions; no target code was executed during this review. Is this the best way to solve the issue? Using ordinary chat admission and atomic input acceptance is a sound approach, but manual recovery must preserve the automatic recovery owner's retained restrictions. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 44998b0afc07. Provenance checked
TestingProof path: shipped entry point. SecurityNeeds attention: Manual recovery can widen the host-retained restart tool policy before execution. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfaceSource +451, Tests +1385, Docs +17. Total +1853 across 60 files. Added test files: 3. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 15, 2026, 8:28 PM ET / October 16, 2026, 00:28 UTC. |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2ec360d41
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| forceRestartSafeTools: turn.opts?.forceRestartSafeTools, | ||
| forceCodeModeTools: turn.opts?.forceCodeModeTools, |
There was a problem hiding this comment.
Prevent CLI fallbacks from dropping restart-safe restrictions
Even with the retained-delivery fullAccess check now fixed, when an embedded in-place continuation requires restart-safe or Code Mode tools and a later model fallback resolves to a CLI backend, these flags reach the shared candidate object but runCliFallbackCandidate does not enforce them. The CLI attempt can therefore execute its ordinary side-effecting tools despite the recovery restriction; reject CLI candidates while either flag is set or add an exact CLI enforcement contract.
AGENTS.md reference: src/agents/AGENTS.md:L23-L25
Useful? React with 👍 / 👎.
| params.mode === "in-place" && | ||
| (params.sessionId !== initialSource.sessionId || | ||
| params.recoveryCycleId !== initialSource.mainRestartRecovery?.cycleId || | ||
| !initialSource.mainRestartRecovery?.tombstone) |
There was a problem hiding this comment.
Fence replacement fallback to the advertised recovery cycle
When another client replaces the session key and that replacement enters a new recovery cycle before a stale CLI-fallback click reaches the Gateway, the UI still sends its captured sessionId and recoveryCycleId with mode: "new-session", but this guard ignores both. The stale request can consequently archive and continue the newer interrupted task; validate supplied identities for replacement mode too while preserving identity-free legacy calls.
AGENTS.md reference: src/gateway/AGENTS.md:L22-L25
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bdadca2ed3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const forceRestartSafeTools = | ||
| retainedSafeTools || policy.action === "complete" || policy.forceRestartSafeTools; |
There was a problem hiding this comment.
Settle completed recovery without starting another turn
When resolveMainSessionResumePolicy returns action: "complete" for a delivered-terminal receipt or a handled-silent turn, this code merely enables restart-safe tools and proceeds to launch another model continuation. That re-executes a task the recovery evidence already proves complete, potentially producing a duplicate reply; for CLI sessions it can even route the user toward creating a replacement session. The automatic recovery path in main-session-restart-recovery-store.ts handles the same policy by calling markSessionCompletedAfterRecoveryCheckpoint without dispatching model work, so in-place recovery should use that completion path instead.
Useful? React with 👍 / 👎.
|
Landing review for head The only failed test is CI checked out merge The lead's same-session restart, fresh-authority, retained-restriction, Gateway admission, UI, and synthetic screenshot proof is accepted. Native policy, security, enforced-review, and exact-head checks remain mandatory for this landing attempt. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c25ebe8a0b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| sessionId: initialSource.sessionId, | ||
| sessionEntry: initialSource, | ||
| }, | ||
| { mode: "recent", maxMessages: 20, maxBytes: 256 * 1024 }, |
There was a problem hiding this comment.
Preserve full-turn replay-safe checkpoints on manual resume
When an interrupted Code Mode turn has more than 20 recent messages, its replay-safe checkpoint can fall outside this bounded read. Unlike automatic recovery, which also calls readMainSessionRecoveryCheckpoint because the display tail can evict that evidence, this path derives retainedSafeTools only from the row and recent messages; under full access it can therefore omit Code Mode controls or continue with unrestricted tools. Read the transcript checkpoint summary and fold its replay-safe fact into the resume policy as the automatic owner does.
AGENTS.md reference: AGENTS.md:L50-L53
Useful? React with 👍 / 👎.
|
Landing this reviewed head ( CI run 38837406620, attempt 1 has one failing test job: The native evidence binds the exact failed attempt and tested merge, retained checkout/failure logs, unchanged source inputs, and the lead's scoped restart, Gateway, queue, and UI proof. Required review, security, and writer-authority checks remain enforced. This exception does not claim that CI passed, and does not change or rewrite the PR branch. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
The in-place resume refactor (#173579) moved returned-outcome handling into the formatter module, leaving formatReturnedAgentErrors exported with only a local caller. Keep the formatter private without changing its aggregation behavior. Retain SessionInputLifecycleAdmission and use explicit type-only imports for its three real production consumers, which Knip missed in inline import types. No Knip ignores or runtime behavior changes. Proof: production and full-tree export scans clear the assigned findings; scripts exports remain zero. Core types, targeted lint/format, the three selected returned-error cases, and isolated P2 review pass. Other export findings reproduce on the unmodified baseline; local unused-file findings are six ignored Mermaid build outputs. The UI wrapper findings were already removed by #173638.
) * fix(sessions): resume interrupted tasks in place * fix(sessions): align resume guidance and authority type imports * fix(sessions): retain restart safety through operator resume * fix(sessions): preserve retained recovery delivery constraints * test(sessions): verify restricted resume and actionable recovery notice
The in-place resume refactor (openclaw#173579) moved returned-outcome handling into the formatter module, leaving formatReturnedAgentErrors exported with only a local caller. Keep the formatter private without changing its aggregation behavior. Retain SessionInputLifecycleAdmission and use explicit type-only imports for its three real production consumers, which Knip missed in inline import types. No Knip ignores or runtime behavior changes. Proof: production and full-tree export scans clear the assigned findings; scripts exports remain zero. Core types, targeted lint/format, the three selected returned-error cases, and isolated P2 review pass. Other export findings reproduce on the unmodified baseline; local unused-file findings are six ignored Mermaid build outputs. The UI wrapper findings were already removed by openclaw#173638.
|
Thanks for #173579. Its description notes that it also fixed, on main, a live-permission bug: That fix is not on On those builds every change to a running native-runtime reply fails, so the documented behaviour ("OpenClaw refreshes the active tool policy without restarting the conversation", docs/gateway/permission-modes.md, "Change permissions during a task") never happens:
So the Control UI's Execution permissions picker, used during a reply, saves the mode, stops the reply, and shows "Failed to update permissions: GatewayRequestError: Permissions were saved, but could not be applied ..." every time. Stock repro (no plugins)Gateway on
Expected (per the docs page): the reply continues under the new mode with the permission-change notice. Would you consider backporting the attempt.ts reorder (record before the await) to |
* test(ui): deslop q0178 tests Remove the duplicate long-diff E2E layer: chat-session-diff-folding.real-gateway.e2e.test.ts covers the identical 64x680 fixture, unified/split rendering, and refresh collapse. session-diff-split.test.ts covers budget fallback and source preservation; chat-session-diff.e2e.test.ts covers deferred refresh. Keep Mermaid touch, clipboard, and source-view expansion; markdown-mermaid-expansion.browser.test.ts owns click/keyboard activation and focus return. Remove success-only Mermaid/bootstrap media capture and compact the message fixture. CI-only campaign: local oxlint, oxfmt, and diff checks passed; no tests or coverage run. Shard LOC 1310 to 1109 (15.3%); below the 40% target because remaining scenarios cover distinct behaviors. * test(qa-lab): remove redundant q0174 product-proof layers Port q0174 onto the campaign lane. The first source commit fb59ddd0922ae0e453987344a4b8be4d723ab551 is already present as 415487d52d22; apply the remaining cleanup from 43b21095aece1a8025b51228db60f96cc412344e without changing newer lane content. Resolve the timing-map conflict by deleting only the inherited-policy entry, preserving the lane removal of the neighboring join-intro entry. Retain CLI SecretRef repair and exec gating, running-Gateway session cleanup, and manual worktree lifecycle proof; remove redundant product-proof layers. Validation: oxlint and oxfmt --check passed on retained touched files; git diff --check and cached diff check passed. Independent read-only review found no actionable issues. Tests not run under the requested CI-only policy. * test(ui): deslop q0180 tests Remove duplicate RPC-envelope assertions and unasserted catalog screenshots. Use the shared page lifecycle for disk-space proof and one assertion helper for linked-session navigation before and after reload. Remaining owner proof: browser-client.test.ts scopes only the session panel and sends transcript references only with its list; browser-panel-controller-input.test.ts captures a successfully navigated document when its tab snapshot fails; model-catalog-store.test.ts reuses pending catalogs until the native discovery owner invalidates them; chat-pane-model-catalog.test.ts revalidates the configured model catalog when the picker opens; cron-page.lifecycle.test.ts verifies configured agent-scoped model requests. Preserve all 13 expanded cases: retry geometry/animation and text scale, export download/clipboard attribution, descendant network blocking through sandbox transitions, real response-body cancellation and error presentation, linked navigation identity/reload, dynamic reasoning/context convergence, accessible disk-pressure recovery, and retained/empty catalog warning isolation. These distinct browser behaviors prevent an honest 40% reduction. LOC 1054 -> 993 (-5.8%). CI-only validation: plain oxlint exit 0, oxfmt and git diff --check passed. No tests, coverage, Testbox, typecheck, or build run. * test(ui): remove redundant q0180 e2e layers Delete chat-export-attribution and cron-agent-ownership E2E replays. Export transport/content remains covered by export.test.ts (readable download and speaker normalization), chat-send-submit.test.ts (local export commands), session-menu-navigation.test.ts (chronological transcript copy), and chat-message.forwarded-attribution.test.ts (never borrow viewer identity). Cron failure/empty recovery remains in cron-page.lifecycle.test.ts, draft preservation and event ordering in cron-page.catalog-notifications.test.ts, and catalog replacement/reopen in command-palette.test.ts. The palette model projection consumes models only, not catalog warning fields. Retain browser screenshot authentication and visible failure, but remove Fetch instrumentation duplicated by browser-client.test.ts: rejects an unsuccessful screenshot without waiting for stream cancellation. Keep disk event-to-accessible-badge proof; chat-view.test.ts owns persistent disk guidance and recovery. Keep dynamic Chat convergence; new-session model-control tests own hydrated defaults/catalog rendering and metadata lifecycle. Drop request-count replays covered by chat-pane-model-catalog.test.ts and the catalog owner. Keep click and direct-link reload proof with colliding prefixes; the no-collision row takes the same full-UUID route branch. Shrink only the deleted files entries in the private-server path list and E2E owner inventory. No production or helper changes. Original shard LOC 1054 -> 631 (-40.1%); this follow-up 993 -> 631. Eight expanded cases remain. CI-only: no tests, coverage, builds, or typechecks run. Plain oxlint exit 0, oxfmt, and git diff --check passed. * test(ui): remove redundant q0172 lifecycle replays Port q0172 from edd7ef1d27b7a9d29ba1340bbffb74c8f35eb854 and 0a4542847769cdc76fbcc911ec36bccf7ebfdaf5 onto the campaign lane. The first cleanup is already present; preserve it and all newer lane inventory changes while applying the remaining lifecycle replay removals and layout fixture cleanup. Validation: plain oxlint, oxfmt --check, and git diff --check exited 0. Isolated review found no actionable issues. CI-only: no tests, coverage, Testbox, or check-changed were run. * test(scripts): deslop q0177 tests Reuse the existing HTTP fixture lifecycle in the installer proof and replace branching prefix fixture setup with explicit overrides. Preserve all installer, provenance, secret-handling, continuation, archive and prefix-stability contracts. Drop the redundant explicit-true plugin fixture variant (default-enabled and disabled remain) and short-option budget replays (the retained long-option case reaches the same startsWith rejection). Keep budget-specific duplicate-option coverage. CI-only campaign: formatting, diff-check and plain oxlint passed; tests and coverage deferred to hosted CI. The shard is already compact and the 40 percent LOC target was not achievable without dropping distinct boundary proof. * test(scripts): consolidate q0177 owner-boundary proof Remove the benchmark discovery lifecycle replay: src/gateway/server-discovery-runtime.test.ts owns starts registered local discovery services with gateway advertisement context and replaces advertisements and wide-area metadata across live mode and registry changes. Retain benchmark config and environment isolation here. Keep formatted statistics and default plugin activation in test/scripts/bench-gateway-startup.test.ts, including requires seeded session access and clean shutdown only for populated fixtures and the teamBoot fixture assertions. Keep CI evidence emission in test/scripts/tsgo-core-test-shards.test.ts, including executes assigned root partitions serially through mixed CI and its transitive-consumer evidence cases. Move runtime-log expectations into the saved-log CLI replay, consume the actual redaction result in notification proof, and assert timed report totals through the budget CLI. Share installer scenario orchestration and reuse the existing archive file builder without changing its public fixture interface. CI-only: plain oxlint, oxfmt and diff-check passed. No tests or coverage run. Shard totals 1239 to 1087 lines; 40 percent remains unmet because the remaining independent security, platform, parser and lifecycle proof has no replacement. * test(scripts): preserve installer failure propagation Run the two POSIX installer subshells as standalone commands under set -e. The preceding consolidation put the healthy installer on the left side of &&, which can suppress errexit inside that subshell. Keep independent EXIT traps without changing the installer behavior under test. Static inspection only under the campaign CI-only instruction; no test runs. * test(scripts): remove redundant q0177 metadata assertion The retained real notify call reads the redaction-result file and requires a boolean notify_required before it can report the asserted skipped result. Remove the duplicate direct file assertion; preserve the notification-gating regression from 5a14b1c. Re-audited PASS 15 moves 1-5: no stale subjects, source-grep inventories, or further safe whole-case deletions remain. Existing distinct security, provenance, runtime accounting, and compiler lifecycle cases block the 40 percent target. Formatting, plain oxlint and diff-check pass; no tests or coverage run under CI-only mode. * test(scripts): deslop q0179 tests Trim same-branch documentation and runtime-path variants. Keep the import-cycle and Kysely regressions from 906eb2d and 38784a3, plus the harness-runtime shutdown guard from 98813c2. Use a direct oversized command in the transport fixture; pr-crabbox-gate-plan.test.ts owns canonical command construction and forwarding. Retain transport hash, exact-byte, oversized payload, tamper and child-join coverage. Remove unused auth fixture timestamps and share legacy-owner assertions across absent and pre-v7 shared databases. CI-only campaign: plain oxlint, oxfmt and diff-check passed; no tests or coverage run. 1200 to 1172 shard lines; below the 40% target because remaining suites protect distinct release, auth, CI and lifecycle boundaries. No production changes. * test(scripts): reduce q0179 fixture and assertion layers Derive copied release closures from entry points and reuse publication-source paths; retain explicit frozen-workflow inputs. Minimize SQLite auth fixtures to the actual queried schema while preserving all schema-owner and view-rejection scenarios. Remove repeated path and Kysely preparation variants, diagnostic wording/file-count assertions, workflow-step traces, and the transport builder replay. The retained oversized Linux payload, tamper and cleanup cases own transport behavior; pr-crabbox-gate-plan.test.ts owns command generation. The startup corpus tier case in ci-node-test-plan.test.ts owns canonical startup inclusion. Keep exact runtime inventory and changed timing-root assertions. CI-only validation: plain oxlint exit 0, oxfmt and diff-check clean. No tests, coverage, builds or Testbox. Shard totals 1200 -> 993 lines (17.3%); 40% remains unmet rather than deleting distinct security, release or lifecycle proof. No production changes or files deleted. * test(scripts): deslop q0181 tests Consolidate iOS fixture ownership and package-fixture subprocess assertions. Remove Android routing restatements covered by ci-workflow-planning tests for native Access job and gate selection. Remove the CLI transport source grep: invocation behavior remains covered by cli-invocation.test.ts, node-runtime-recovery.test.ts (preserves invocation and replacement exit), and respawn-child-runner.process.test.ts (real transport completion). CI-only campaign: formatting, diff check, and plain oxlint pass. No tests or coverage run. Retain distinct signing, release selection/evidence, SDK removal, correlation ordering, and transition ownership cases; the shard cannot meet 40 percent without deleting their only proof. * test(scripts): remove redundant q0181 proof layers Drop workflow wiring and copied inventories while retaining permission, evidence allowlist, tooling pin, executable shell guard, and native report/APK validation contracts. Package ignore behavior is asserted through the staged Git tree. Replace the preload-byte snapshot with existing executable coverage in src/process/respawn-child-runner.process.test.ts, src/infra/node-runtime-recovery.test.ts, and test/scripts/bun-standalone-support.test.ts. Consolidate iOS canonical selection into the real metadata-parser fixture. Retain followup transition cases instead of repeating the same accepted merge/rebase branches; keep all refusal cases. CI-only validation: plain oxlint, oxfmt, and git diff --check passed. No tests or coverage run. This second pass remains below the 40 percent target because the remaining suites retain distinct owner branches and shared merge assertion support. * test(scripts): consolidate q0181 driving fixtures Share standalone manifest setup across projection and admission tests without dropping metadata branches. Keep the three signing-team decision paths in a compact table and remove same-path SwiftLint invalid-name input variants. Read-only sibling audit confirms CLI manifest admission, package offline installation/relocation, and committed merge/rebase resolve-undo ownership have no equivalent replacement tests. Shared PR assertion helpers also have out-of-shard callers and cannot be deleted without breaking them. No subject in this shard is retired. CI-only: oxfmt, plain oxlint and diff check passed; no tests or coverage run. Total remains below the requested 40 percent reduction rather than deleting uniquely covered behavior. * test(ui): deslop q0182 tests Reuse existing board and response fixtures and consolidate repeated model filtering setup. Keep every scenario and distinct assertion: the remaining split-face URL poll subsumes the substring check, strict visible person locators subsume duplicate count checks, and the retained error-state filter cycle covers provider filtering. * test(scripts): deslop q0183 tests Keep one curl failure per native installer: exit 28 and 56 both terminate at the same set -e boundary, with no status-specific branch. Retain timeout flags, pinned URLs, checksum rejection, and version checks. Share worker stdout/stderr capture and reuse the existing module-membership predicate without dropping stream closure, bounded output, bundle isolation, or restore/export assertions. CI-only campaign: formatting, diff check, and plain oxlint pass; runtime proof is deferred to hosted CI. Shard lines 1363 -> 1346; distinct contracts prevent the requested 40% cut. * test(scripts): consolidate q0183 proof layers Retain emitted stream isolation from regression d57f91b while sharing owner assertions. The state-read-worker-stream fixture already asserts the selected emitted URL and ordered restore/export values; managed-child-process.drain and .output tests own process/pipe settlement. Retain managed command cleanup rather than reimplementing its observers here. Keep one legacy-import scenario through recovery, retained blobs, and Git collection; generic immediate completion remains in pr-merge-outcome tests. Keep measured-large failure, empty-state equality, and explicit override budget branches. Drop duplicate tagged-reference input and process option restatements; keep inspection bounds and attestation rejection. CI-only: plain oxlint, oxfmt, and diff check pass. No tests or coverage run. Shard 1363 -> 1275 lines, below 40 percent target; remaining proof covers distinct behavior, including security and regression boundaries. * test(ui): deslop q0185 tests Remove exact microphone-guidance replay covered by browser-talk-microphone-lifetime.e2e.test.ts, and numeric stepping/search dismissal replays covered by plugins-settings-keyboard.e2e.test.ts. Keep all consent decisions and whole-value schema branches. Retire the mocked restart E2E layer: chat-pane-recovery.test.ts retains in-place recovery, rejected continuation, replacement navigation and draft preservation; chat-composer-disabled-banner.test.ts retains action dispatch and busy rendering. Both owner layers cover the original #173579 regression. Keep sidebar keyboard, pushed-update and narrow viewport proof; session-hovercard.test.ts owns PR ordering/states/checks and session-progress-hovercard-target.test.ts owns pushed rate-limit notices. Keep tweet media, missing-preview and long-text paths; remove ordinary text rows already exercised by media and long-text cases. Remove screenshot-only artifact generation and duplicate pagination failure diagnostics, preserving assertions and shared harness capture. CI-only campaign: no runtime or coverage runs. Static oxlint, oxfmt and diff checks pass. Test LOC 1120 -> 749 (33.1%); declarations 11 -> 7; expanded cases 25 -> 14. Below the 40% line target because remaining flows are distinct. * test(media): deslop q0184 tests Remove redundant media-understanding and fetch scenarios while retaining real CLI, proxy, channel lifecycle, SSRF, redirect and prepared music-provider integration proof. Audio selection remains covered by src/media-understanding/attachments.guards.test.ts, apply.test.ts (preflight skips and last-preference transcript ordering), and audio-preflight.attachments.test.ts (configured selection and limits). Native vision handoff remains in runner.vision-skip.test.ts; current-turn-images.test.ts covers native bytes and described-image suppression. Music fallback, unsupported controls and duration normalization remain in src/music-generation/runtime.test.ts. src/agents/tools/music-generate-tool.test.ts covers explicit deployment refs, ignored-override warnings and normalized-duration details. Keep prepared-provider invocation, audio persistence and invalid-format rejection here. Both fetch overflow paths and empty-store cleanup remain in src/media/fetch.test.ts: cleans up streamed/content-length media overflow before a response clone is released. Remove the obsolete native-catalog mock baseline entry. CI-only: no tests or coverage run. oxfmt, plain oxlint and git diff --check passed. Shard test lines: 1239 -> 1026 (17.2%); declarations: 12 -> 9. Below the 40% target because remaining transport, lifecycle and security compositions have no equivalent stronger proof. * test(media): consolidate q0184 owner-boundary proof Reuse the existing QA mock image endpoint instead of a second controlled server. Keep actual image delivery and internal completion provenance. Duplicate running/recent task interleavings remain in src/agents/tools/image-generate-tool.test.ts: starts image generation asynchronously and keeps the selected filename on completion; returns active status for a duplicate image request with the same prompt; returns recent status for a repeated image request after fast task completion. Keep actual CONNECT routing and upstream socket identity. Oversize-before-provider execution remains in src/media-understanding/apply.test.ts: marks audio exceeding maxBytes in audio-only mode. Multipart model and file serialization remain in extensions/openai/media-understanding-provider.test.ts: builds the expected request payload. Keep real cross-origin redirect rejection, empty-store checks and sensitive-header stripping. Initial private-address rejection remains in src/infra/net/fetch-guard.ssrf.test.ts: blocks private URLs and redacts their path, query and fragment from audit logs. Described-image suppression remains in src/auto-reply/media-note.test.ts and src/auto-reply/reply/current-turn-images.test.ts. Retain prepared music-provider invocation, real persistence and invalid-format rejection; control normalization and forwarding remain in src/music-generation/runtime.test.ts and src/agents/tools/music-generate-tool.test.ts. Minimize unused catalog/override fixtures and remove redundant request cursor setup on a fresh mock server. CI-only: no tests or coverage runs. Plain oxlint, oxfmt and git diff --check passed. Original shard: 1239 -> 740 test lines (-40.3%), 12 -> 8 declarations. This follow-up: 1026 -> 740 lines. All seven scenario test paths remain; no production or shared helper changes. * test(scripts): consolidate q0179 owner-level proof Port the remaining q0179 consolidation onto the campaign lane. The first two shard commits are already present as 8b5d5956ef16 and 6977002b3a0a. Preserve the lane removal of obsolete locale artifact-fault variants. CI-only validation: plain oxlint and oxfmt --check passed on all nine touched files; git diff --check passed. Independent review found no actionable P0-P2 findings. No tests or builds were run. * test(scripts): deslop q0186 tests Reuse script fixture files and centralize release planning setup without deleting cases. Recovery retains persisted report, exact call count, unique nested IDs and exec/wait checks; remove redundant read/write spy ordering and cleanup assertion. Lifecycle cleanup remains covered by src/agents/code-mode.catalog-lifetime.test.ts and code-mode.test.ts. CI-only validation: plain oxlint, oxfmt and git diff --check. No tests or coverage executed. Shard LOC 1201 to 1174; 40 percent target not reached because remaining suites exercise distinct release, isolation, cancellation and parser behavior. * test(scripts): remove redundant q0186 proof layers Delete the recovery matrix transport replay. code-mode-matrix-recovery-tasks.test.ts retains settlement effects, reconciliation, report persistence and negative controls. src/agents/code-mode.agent-loop.test.ts retains parked-error recovery without replay and partial-effect recovery; code-mode.wait.test.ts retains suspension ownership, original call identity and non-replay. Keep report grouping and unlimited-output assertions without repeating the full header snapshot. Drop duplicate registry catch-path rows; npm-publish-plan.test.ts retains missing-selector classification and plugin-npm-prepared-release.test.ts retains 404 propagation. Keep malformed selectors, both package identity checks, byte integrity and size rejection. Default runtime still exercises the Bun gateway branch; test-runtime.test.ts owns explicit runtime selection. Keep one caller-cache override rather than replaying it with the string zero. CI-only: oxfmt, plain oxlint and diff check pass. No tests or coverage run. Cumulative shard LOC 1201 to 1058; 40 percent target remains unmet. No obsolete subjects or further equivalent security/lifecycle proof found. * test(scripts): consolidate q0186 owner-boundary proof Drop duplicate skip-report CLI and grouping cases: inventory-report-cli.test.ts owns argument parsing and unlimited output; test-env-mutation-report.test.ts owns the shared grouped renderer. Keep skip-specific classification and empty output. Consolidate same/new Android train execution in one two-row table with version, properties, plist and release-note assertions. Shared flag behavior remains in arg-utils.test.ts and android-version.test.ts. Private handoff observations now follow successful injection and store preflight, retaining independent launch matching and per-consumer witnesses. CI-only: oxfmt, plain oxlint and diff check pass; no tests or coverage executed. Cumulative shard LOC 1201 to 970. Further reduction to 40 percent was not supported by equivalent retained boundary proof. * test(ui): deslop q0187 tests Keep browser coverage for blocked submission, IME/stale metadata, disappearing usage selections, avatar timeout layout, and rail geometry. Drop repeated scenario variants covered by the retained scenarios and owner tests. Remaining owner proof: pages/new-session/composer.test.tsx (disabled Start reports attempts); pages/chat/components/chat-pane-header.test.tsx and e2e/session-management.rename.e2e.test.ts (IME and ordinary Escape); components/agent-select.test.ts and components/solid/identity-avatar.test.tsx (loaded/error avatar state and rerenders); packages/normalization-core/src/utf16-slice.test.ts (ASCII and surrogate truncation). All UI paths are under ui/src/. CI-only campaign: oxfmt, plain oxlint, and git diff --check pass. No runtime tests or coverage executed. Retain distinct lifecycle, accessibility, geometry, and persistence scenarios; line reduction is below the 40 percent target. * test(ui): deslop q0189 tests Remove the Agents alias replay: pages/agents/view.test.tsx covers canonical names and configured aliases, and pages/agents/agents-page.test.ts covers loading the selected agent's configured catalog once. Retain the chat picker case for provider-suffix rendering and replace manual context cleanup with the suite-owned page lifecycle. * test(ui): remove redundant q0189 e2e layers Remove the llama.cpp provider replay: model-setup-lmstudio.e2e.test.ts owns the shared prepare, confirm, activate and settings flow. pages/model-setup/view.test.ts covers llama.cpp choices and icons; configured-model.test.ts covers its model state; model-setup-page.test.ts covers autonomous progress; model-setup-explicit.e2e.test.ts keeps consent; components/modal-dialog.browser.test.ts owns animation visibility. Keep runtime budgets in Chromium. Delegate denied choices and default reset to pages/chat/components/chat-model-policy.test.ts, pages/chat/chat-model-runtime.test.ts and lib/chat/model-select-state.test.ts. Delegate private mirror hydration to components/session-background.test.ts and app/server-prefs.background.test.ts while retaining first-paint requests. Keep rejected publication, prepared history, draft and canonicalization in one browser flow. route-prepared-identity.test.ts retains conflicting resolver and ordinary resolution branches. pages/custodian/custodian-session-store.test.ts owns persistence across stores; keep Home and palette navigation in Chromium. Reuse equivalent context and frame helpers; keep all ACK interleavings and typing work assertions. CI-only: no tests, coverage or builds run. Plain oxlint, oxfmt and diff-check pass. Original shard 936 lines to 559 lines (40.3 percent reduction); only deleted-path entries removed from CI owner and timing lists. * test(scripts): deslop q0188 tests Remove copied suppression inventory and redundant planner serialization/prerequisite assertions. ci-changed-node-test-plan.test.ts retains canonical paired-owner checks and the Git tooling codec/prerequisite round trip. Keep precise selection ownership here. Consolidate empty changelog proof at the Android release-note boundary, share model assertions and createRequire fixtures, and simplify preflight rejection setup without removing release safety cases. CI-only campaign: oxlint, oxfmt and diff checks pass; runtime tests and coverage deferred to hosted CI. Reduction is 81 of 1194 lines (6.8%); retain distinct safeguards rather than force the 40% target. * test(scripts): consolidate q0188 tooling proof layers Remove the filename-based memory import graph, stale host-literal inventory, provider metadata restatements and repeated planner/runtime matrices. Keep curl limits at the executable boundary and reuse filesystem/Git fixtures. Remaining owner proof: ci-changed-node-test-plan.test.ts retains delivery-cache coverage and private QA preparation, plus precise TUI/Git owner selections; ci-run-node-test-shard.test.ts keeps changed qualification inputs on Vitest; onboard-config-fixtures.test.ts writes guided skip-UI fixtures through the same mock config owner. Keep unique store identity/exhaustion, auth retry/cooldown, ref-integrity, syntax scanner and release dispatch guards. Static lint/format/diff checks pass; no test or coverage runs in CI-only mode. Original shard 1194 lines -> 840 (29.6%): 40% target remains unmet. * test: repair d467 fixtures and preserve private-target proof * test: type optional lint fixture lines explicitly
…2570) * test(ui): deslop q0178 tests Remove the duplicate long-diff E2E layer: chat-session-diff-folding.real-gateway.e2e.test.ts covers the identical 64x680 fixture, unified/split rendering, and refresh collapse. session-diff-split.test.ts covers budget fallback and source preservation; chat-session-diff.e2e.test.ts covers deferred refresh. Keep Mermaid touch, clipboard, and source-view expansion; markdown-mermaid-expansion.browser.test.ts owns click/keyboard activation and focus return. Remove success-only Mermaid/bootstrap media capture and compact the message fixture. CI-only campaign: local oxlint, oxfmt, and diff checks passed; no tests or coverage run. Shard LOC 1310 to 1109 (15.3%); below the 40% target because remaining scenarios cover distinct behaviors. * test(qa-lab): remove redundant q0174 product-proof layers Port q0174 onto the campaign lane. The first source commit fb59ddd0922ae0e453987344a4b8be4d723ab551 is already present as 415487d52d22; apply the remaining cleanup from 43b21095aece1a8025b51228db60f96cc412344e without changing newer lane content. Resolve the timing-map conflict by deleting only the inherited-policy entry, preserving the lane removal of the neighboring join-intro entry. Retain CLI SecretRef repair and exec gating, running-Gateway session cleanup, and manual worktree lifecycle proof; remove redundant product-proof layers. Validation: oxlint and oxfmt --check passed on retained touched files; git diff --check and cached diff check passed. Independent read-only review found no actionable issues. Tests not run under the requested CI-only policy. * test(ui): deslop q0180 tests Remove duplicate RPC-envelope assertions and unasserted catalog screenshots. Use the shared page lifecycle for disk-space proof and one assertion helper for linked-session navigation before and after reload. Remaining owner proof: browser-client.test.ts scopes only the session panel and sends transcript references only with its list; browser-panel-controller-input.test.ts captures a successfully navigated document when its tab snapshot fails; model-catalog-store.test.ts reuses pending catalogs until the native discovery owner invalidates them; chat-pane-model-catalog.test.ts revalidates the configured model catalog when the picker opens; cron-page.lifecycle.test.ts verifies configured agent-scoped model requests. Preserve all 13 expanded cases: retry geometry/animation and text scale, export download/clipboard attribution, descendant network blocking through sandbox transitions, real response-body cancellation and error presentation, linked navigation identity/reload, dynamic reasoning/context convergence, accessible disk-pressure recovery, and retained/empty catalog warning isolation. These distinct browser behaviors prevent an honest 40% reduction. LOC 1054 -> 993 (-5.8%). CI-only validation: plain oxlint exit 0, oxfmt and git diff --check passed. No tests, coverage, Testbox, typecheck, or build run. * test(ui): remove redundant q0180 e2e layers Delete chat-export-attribution and cron-agent-ownership E2E replays. Export transport/content remains covered by export.test.ts (readable download and speaker normalization), chat-send-submit.test.ts (local export commands), session-menu-navigation.test.ts (chronological transcript copy), and chat-message.forwarded-attribution.test.ts (never borrow viewer identity). Cron failure/empty recovery remains in cron-page.lifecycle.test.ts, draft preservation and event ordering in cron-page.catalog-notifications.test.ts, and catalog replacement/reopen in command-palette.test.ts. The palette model projection consumes models only, not catalog warning fields. Retain browser screenshot authentication and visible failure, but remove Fetch instrumentation duplicated by browser-client.test.ts: rejects an unsuccessful screenshot without waiting for stream cancellation. Keep disk event-to-accessible-badge proof; chat-view.test.ts owns persistent disk guidance and recovery. Keep dynamic Chat convergence; new-session model-control tests own hydrated defaults/catalog rendering and metadata lifecycle. Drop request-count replays covered by chat-pane-model-catalog.test.ts and the catalog owner. Keep click and direct-link reload proof with colliding prefixes; the no-collision row takes the same full-UUID route branch. Shrink only the deleted files entries in the private-server path list and E2E owner inventory. No production or helper changes. Original shard LOC 1054 -> 631 (-40.1%); this follow-up 993 -> 631. Eight expanded cases remain. CI-only: no tests, coverage, builds, or typechecks run. Plain oxlint exit 0, oxfmt, and git diff --check passed. * test(ui): remove redundant q0172 lifecycle replays Port q0172 from edd7ef1d27b7a9d29ba1340bbffb74c8f35eb854 and 0a4542847769cdc76fbcc911ec36bccf7ebfdaf5 onto the campaign lane. The first cleanup is already present; preserve it and all newer lane inventory changes while applying the remaining lifecycle replay removals and layout fixture cleanup. Validation: plain oxlint, oxfmt --check, and git diff --check exited 0. Isolated review found no actionable issues. CI-only: no tests, coverage, Testbox, or check-changed were run. * test(scripts): deslop q0177 tests Reuse the existing HTTP fixture lifecycle in the installer proof and replace branching prefix fixture setup with explicit overrides. Preserve all installer, provenance, secret-handling, continuation, archive and prefix-stability contracts. Drop the redundant explicit-true plugin fixture variant (default-enabled and disabled remain) and short-option budget replays (the retained long-option case reaches the same startsWith rejection). Keep budget-specific duplicate-option coverage. CI-only campaign: formatting, diff-check and plain oxlint passed; tests and coverage deferred to hosted CI. The shard is already compact and the 40 percent LOC target was not achievable without dropping distinct boundary proof. * test(scripts): consolidate q0177 owner-boundary proof Remove the benchmark discovery lifecycle replay: src/gateway/server-discovery-runtime.test.ts owns starts registered local discovery services with gateway advertisement context and replaces advertisements and wide-area metadata across live mode and registry changes. Retain benchmark config and environment isolation here. Keep formatted statistics and default plugin activation in test/scripts/bench-gateway-startup.test.ts, including requires seeded session access and clean shutdown only for populated fixtures and the teamBoot fixture assertions. Keep CI evidence emission in test/scripts/tsgo-core-test-shards.test.ts, including executes assigned root partitions serially through mixed CI and its transitive-consumer evidence cases. Move runtime-log expectations into the saved-log CLI replay, consume the actual redaction result in notification proof, and assert timed report totals through the budget CLI. Share installer scenario orchestration and reuse the existing archive file builder without changing its public fixture interface. CI-only: plain oxlint, oxfmt and diff-check passed. No tests or coverage run. Shard totals 1239 to 1087 lines; 40 percent remains unmet because the remaining independent security, platform, parser and lifecycle proof has no replacement. * test(scripts): preserve installer failure propagation Run the two POSIX installer subshells as standalone commands under set -e. The preceding consolidation put the healthy installer on the left side of &&, which can suppress errexit inside that subshell. Keep independent EXIT traps without changing the installer behavior under test. Static inspection only under the campaign CI-only instruction; no test runs. * test(scripts): remove redundant q0177 metadata assertion The retained real notify call reads the redaction-result file and requires a boolean notify_required before it can report the asserted skipped result. Remove the duplicate direct file assertion; preserve the notification-gating regression from be4e5ec. Re-audited PASS 15 moves 1-5: no stale subjects, source-grep inventories, or further safe whole-case deletions remain. Existing distinct security, provenance, runtime accounting, and compiler lifecycle cases block the 40 percent target. Formatting, plain oxlint and diff-check pass; no tests or coverage run under CI-only mode. * test(scripts): deslop q0179 tests Trim same-branch documentation and runtime-path variants. Keep the import-cycle and Kysely regressions from 19ad4ab and b5049b8, plus the harness-runtime shutdown guard from 27cbae0. Use a direct oversized command in the transport fixture; pr-crabbox-gate-plan.test.ts owns canonical command construction and forwarding. Retain transport hash, exact-byte, oversized payload, tamper and child-join coverage. Remove unused auth fixture timestamps and share legacy-owner assertions across absent and pre-v7 shared databases. CI-only campaign: plain oxlint, oxfmt and diff-check passed; no tests or coverage run. 1200 to 1172 shard lines; below the 40% target because remaining suites protect distinct release, auth, CI and lifecycle boundaries. No production changes. * test(scripts): reduce q0179 fixture and assertion layers Derive copied release closures from entry points and reuse publication-source paths; retain explicit frozen-workflow inputs. Minimize SQLite auth fixtures to the actual queried schema while preserving all schema-owner and view-rejection scenarios. Remove repeated path and Kysely preparation variants, diagnostic wording/file-count assertions, workflow-step traces, and the transport builder replay. The retained oversized Linux payload, tamper and cleanup cases own transport behavior; pr-crabbox-gate-plan.test.ts owns command generation. The startup corpus tier case in ci-node-test-plan.test.ts owns canonical startup inclusion. Keep exact runtime inventory and changed timing-root assertions. CI-only validation: plain oxlint exit 0, oxfmt and diff-check clean. No tests, coverage, builds or Testbox. Shard totals 1200 -> 993 lines (17.3%); 40% remains unmet rather than deleting distinct security, release or lifecycle proof. No production changes or files deleted. * test(scripts): deslop q0181 tests Consolidate iOS fixture ownership and package-fixture subprocess assertions. Remove Android routing restatements covered by ci-workflow-planning tests for native Access job and gate selection. Remove the CLI transport source grep: invocation behavior remains covered by cli-invocation.test.ts, node-runtime-recovery.test.ts (preserves invocation and replacement exit), and respawn-child-runner.process.test.ts (real transport completion). CI-only campaign: formatting, diff check, and plain oxlint pass. No tests or coverage run. Retain distinct signing, release selection/evidence, SDK removal, correlation ordering, and transition ownership cases; the shard cannot meet 40 percent without deleting their only proof. * test(scripts): remove redundant q0181 proof layers Drop workflow wiring and copied inventories while retaining permission, evidence allowlist, tooling pin, executable shell guard, and native report/APK validation contracts. Package ignore behavior is asserted through the staged Git tree. Replace the preload-byte snapshot with existing executable coverage in src/process/respawn-child-runner.process.test.ts, src/infra/node-runtime-recovery.test.ts, and test/scripts/bun-standalone-support.test.ts. Consolidate iOS canonical selection into the real metadata-parser fixture. Retain followup transition cases instead of repeating the same accepted merge/rebase branches; keep all refusal cases. CI-only validation: plain oxlint, oxfmt, and git diff --check passed. No tests or coverage run. This second pass remains below the 40 percent target because the remaining suites retain distinct owner branches and shared merge assertion support. * test(scripts): consolidate q0181 driving fixtures Share standalone manifest setup across projection and admission tests without dropping metadata branches. Keep the three signing-team decision paths in a compact table and remove same-path SwiftLint invalid-name input variants. Read-only sibling audit confirms CLI manifest admission, package offline installation/relocation, and committed merge/rebase resolve-undo ownership have no equivalent replacement tests. Shared PR assertion helpers also have out-of-shard callers and cannot be deleted without breaking them. No subject in this shard is retired. CI-only: oxfmt, plain oxlint and diff check passed; no tests or coverage run. Total remains below the requested 40 percent reduction rather than deleting uniquely covered behavior. * test(ui): deslop q0182 tests Reuse existing board and response fixtures and consolidate repeated model filtering setup. Keep every scenario and distinct assertion: the remaining split-face URL poll subsumes the substring check, strict visible person locators subsume duplicate count checks, and the retained error-state filter cycle covers provider filtering. * test(scripts): deslop q0183 tests Keep one curl failure per native installer: exit 28 and 56 both terminate at the same set -e boundary, with no status-specific branch. Retain timeout flags, pinned URLs, checksum rejection, and version checks. Share worker stdout/stderr capture and reuse the existing module-membership predicate without dropping stream closure, bounded output, bundle isolation, or restore/export assertions. CI-only campaign: formatting, diff check, and plain oxlint pass; runtime proof is deferred to hosted CI. Shard lines 1363 -> 1346; distinct contracts prevent the requested 40% cut. * test(scripts): consolidate q0183 proof layers Retain emitted stream isolation from regression 096fe2a while sharing owner assertions. The state-read-worker-stream fixture already asserts the selected emitted URL and ordered restore/export values; managed-child-process.drain and .output tests own process/pipe settlement. Retain managed command cleanup rather than reimplementing its observers here. Keep one legacy-import scenario through recovery, retained blobs, and Git collection; generic immediate completion remains in pr-merge-outcome tests. Keep measured-large failure, empty-state equality, and explicit override budget branches. Drop duplicate tagged-reference input and process option restatements; keep inspection bounds and attestation rejection. CI-only: plain oxlint, oxfmt, and diff check pass. No tests or coverage run. Shard 1363 -> 1275 lines, below 40 percent target; remaining proof covers distinct behavior, including security and regression boundaries. * test(ui): deslop q0185 tests Remove exact microphone-guidance replay covered by browser-talk-microphone-lifetime.e2e.test.ts, and numeric stepping/search dismissal replays covered by plugins-settings-keyboard.e2e.test.ts. Keep all consent decisions and whole-value schema branches. Retire the mocked restart E2E layer: chat-pane-recovery.test.ts retains in-place recovery, rejected continuation, replacement navigation and draft preservation; chat-composer-disabled-banner.test.ts retains action dispatch and busy rendering. Both owner layers cover the original openclaw#173579 regression. Keep sidebar keyboard, pushed-update and narrow viewport proof; session-hovercard.test.ts owns PR ordering/states/checks and session-progress-hovercard-target.test.ts owns pushed rate-limit notices. Keep tweet media, missing-preview and long-text paths; remove ordinary text rows already exercised by media and long-text cases. Remove screenshot-only artifact generation and duplicate pagination failure diagnostics, preserving assertions and shared harness capture. CI-only campaign: no runtime or coverage runs. Static oxlint, oxfmt and diff checks pass. Test LOC 1120 -> 749 (33.1%); declarations 11 -> 7; expanded cases 25 -> 14. Below the 40% line target because remaining flows are distinct. * test(media): deslop q0184 tests Remove redundant media-understanding and fetch scenarios while retaining real CLI, proxy, channel lifecycle, SSRF, redirect and prepared music-provider integration proof. Audio selection remains covered by src/media-understanding/attachments.guards.test.ts, apply.test.ts (preflight skips and last-preference transcript ordering), and audio-preflight.attachments.test.ts (configured selection and limits). Native vision handoff remains in runner.vision-skip.test.ts; current-turn-images.test.ts covers native bytes and described-image suppression. Music fallback, unsupported controls and duration normalization remain in src/music-generation/runtime.test.ts. src/agents/tools/music-generate-tool.test.ts covers explicit deployment refs, ignored-override warnings and normalized-duration details. Keep prepared-provider invocation, audio persistence and invalid-format rejection here. Both fetch overflow paths and empty-store cleanup remain in src/media/fetch.test.ts: cleans up streamed/content-length media overflow before a response clone is released. Remove the obsolete native-catalog mock baseline entry. CI-only: no tests or coverage run. oxfmt, plain oxlint and git diff --check passed. Shard test lines: 1239 -> 1026 (17.2%); declarations: 12 -> 9. Below the 40% target because remaining transport, lifecycle and security compositions have no equivalent stronger proof. * test(media): consolidate q0184 owner-boundary proof Reuse the existing QA mock image endpoint instead of a second controlled server. Keep actual image delivery and internal completion provenance. Duplicate running/recent task interleavings remain in src/agents/tools/image-generate-tool.test.ts: starts image generation asynchronously and keeps the selected filename on completion; returns active status for a duplicate image request with the same prompt; returns recent status for a repeated image request after fast task completion. Keep actual CONNECT routing and upstream socket identity. Oversize-before-provider execution remains in src/media-understanding/apply.test.ts: marks audio exceeding maxBytes in audio-only mode. Multipart model and file serialization remain in extensions/openai/media-understanding-provider.test.ts: builds the expected request payload. Keep real cross-origin redirect rejection, empty-store checks and sensitive-header stripping. Initial private-address rejection remains in src/infra/net/fetch-guard.ssrf.test.ts: blocks private URLs and redacts their path, query and fragment from audit logs. Described-image suppression remains in src/auto-reply/media-note.test.ts and src/auto-reply/reply/current-turn-images.test.ts. Retain prepared music-provider invocation, real persistence and invalid-format rejection; control normalization and forwarding remain in src/music-generation/runtime.test.ts and src/agents/tools/music-generate-tool.test.ts. Minimize unused catalog/override fixtures and remove redundant request cursor setup on a fresh mock server. CI-only: no tests or coverage runs. Plain oxlint, oxfmt and git diff --check passed. Original shard: 1239 -> 740 test lines (-40.3%), 12 -> 8 declarations. This follow-up: 1026 -> 740 lines. All seven scenario test paths remain; no production or shared helper changes. * test(scripts): consolidate q0179 owner-level proof Port the remaining q0179 consolidation onto the campaign lane. The first two shard commits are already present as 8b5d5956ef16 and 6977002b3a0a. Preserve the lane removal of obsolete locale artifact-fault variants. CI-only validation: plain oxlint and oxfmt --check passed on all nine touched files; git diff --check passed. Independent review found no actionable P0-P2 findings. No tests or builds were run. * test(scripts): deslop q0186 tests Reuse script fixture files and centralize release planning setup without deleting cases. Recovery retains persisted report, exact call count, unique nested IDs and exec/wait checks; remove redundant read/write spy ordering and cleanup assertion. Lifecycle cleanup remains covered by src/agents/code-mode.catalog-lifetime.test.ts and code-mode.test.ts. CI-only validation: plain oxlint, oxfmt and git diff --check. No tests or coverage executed. Shard LOC 1201 to 1174; 40 percent target not reached because remaining suites exercise distinct release, isolation, cancellation and parser behavior. * test(scripts): remove redundant q0186 proof layers Delete the recovery matrix transport replay. code-mode-matrix-recovery-tasks.test.ts retains settlement effects, reconciliation, report persistence and negative controls. src/agents/code-mode.agent-loop.test.ts retains parked-error recovery without replay and partial-effect recovery; code-mode.wait.test.ts retains suspension ownership, original call identity and non-replay. Keep report grouping and unlimited-output assertions without repeating the full header snapshot. Drop duplicate registry catch-path rows; npm-publish-plan.test.ts retains missing-selector classification and plugin-npm-prepared-release.test.ts retains 404 propagation. Keep malformed selectors, both package identity checks, byte integrity and size rejection. Default runtime still exercises the Bun gateway branch; test-runtime.test.ts owns explicit runtime selection. Keep one caller-cache override rather than replaying it with the string zero. CI-only: oxfmt, plain oxlint and diff check pass. No tests or coverage run. Cumulative shard LOC 1201 to 1058; 40 percent target remains unmet. No obsolete subjects or further equivalent security/lifecycle proof found. * test(scripts): consolidate q0186 owner-boundary proof Drop duplicate skip-report CLI and grouping cases: inventory-report-cli.test.ts owns argument parsing and unlimited output; test-env-mutation-report.test.ts owns the shared grouped renderer. Keep skip-specific classification and empty output. Consolidate same/new Android train execution in one two-row table with version, properties, plist and release-note assertions. Shared flag behavior remains in arg-utils.test.ts and android-version.test.ts. Private handoff observations now follow successful injection and store preflight, retaining independent launch matching and per-consumer witnesses. CI-only: oxfmt, plain oxlint and diff check pass; no tests or coverage executed. Cumulative shard LOC 1201 to 970. Further reduction to 40 percent was not supported by equivalent retained boundary proof. * test(ui): deslop q0187 tests Keep browser coverage for blocked submission, IME/stale metadata, disappearing usage selections, avatar timeout layout, and rail geometry. Drop repeated scenario variants covered by the retained scenarios and owner tests. Remaining owner proof: pages/new-session/composer.test.tsx (disabled Start reports attempts); pages/chat/components/chat-pane-header.test.tsx and e2e/session-management.rename.e2e.test.ts (IME and ordinary Escape); components/agent-select.test.ts and components/solid/identity-avatar.test.tsx (loaded/error avatar state and rerenders); packages/normalization-core/src/utf16-slice.test.ts (ASCII and surrogate truncation). All UI paths are under ui/src/. CI-only campaign: oxfmt, plain oxlint, and git diff --check pass. No runtime tests or coverage executed. Retain distinct lifecycle, accessibility, geometry, and persistence scenarios; line reduction is below the 40 percent target. * test(ui): deslop q0189 tests Remove the Agents alias replay: pages/agents/view.test.tsx covers canonical names and configured aliases, and pages/agents/agents-page.test.ts covers loading the selected agent's configured catalog once. Retain the chat picker case for provider-suffix rendering and replace manual context cleanup with the suite-owned page lifecycle. * test(ui): remove redundant q0189 e2e layers Remove the llama.cpp provider replay: model-setup-lmstudio.e2e.test.ts owns the shared prepare, confirm, activate and settings flow. pages/model-setup/view.test.ts covers llama.cpp choices and icons; configured-model.test.ts covers its model state; model-setup-page.test.ts covers autonomous progress; model-setup-explicit.e2e.test.ts keeps consent; components/modal-dialog.browser.test.ts owns animation visibility. Keep runtime budgets in Chromium. Delegate denied choices and default reset to pages/chat/components/chat-model-policy.test.ts, pages/chat/chat-model-runtime.test.ts and lib/chat/model-select-state.test.ts. Delegate private mirror hydration to components/session-background.test.ts and app/server-prefs.background.test.ts while retaining first-paint requests. Keep rejected publication, prepared history, draft and canonicalization in one browser flow. route-prepared-identity.test.ts retains conflicting resolver and ordinary resolution branches. pages/custodian/custodian-session-store.test.ts owns persistence across stores; keep Home and palette navigation in Chromium. Reuse equivalent context and frame helpers; keep all ACK interleavings and typing work assertions. CI-only: no tests, coverage or builds run. Plain oxlint, oxfmt and diff-check pass. Original shard 936 lines to 559 lines (40.3 percent reduction); only deleted-path entries removed from CI owner and timing lists. * test(scripts): deslop q0188 tests Remove copied suppression inventory and redundant planner serialization/prerequisite assertions. ci-changed-node-test-plan.test.ts retains canonical paired-owner checks and the Git tooling codec/prerequisite round trip. Keep precise selection ownership here. Consolidate empty changelog proof at the Android release-note boundary, share model assertions and createRequire fixtures, and simplify preflight rejection setup without removing release safety cases. CI-only campaign: oxlint, oxfmt and diff checks pass; runtime tests and coverage deferred to hosted CI. Reduction is 81 of 1194 lines (6.8%); retain distinct safeguards rather than force the 40% target. * test(scripts): consolidate q0188 tooling proof layers Remove the filename-based memory import graph, stale host-literal inventory, provider metadata restatements and repeated planner/runtime matrices. Keep curl limits at the executable boundary and reuse filesystem/Git fixtures. Remaining owner proof: ci-changed-node-test-plan.test.ts retains delivery-cache coverage and private QA preparation, plus precise TUI/Git owner selections; ci-run-node-test-shard.test.ts keeps changed qualification inputs on Vitest; onboard-config-fixtures.test.ts writes guided skip-UI fixtures through the same mock config owner. Keep unique store identity/exhaustion, auth retry/cooldown, ref-integrity, syntax scanner and release dispatch guards. Static lint/format/diff checks pass; no test or coverage runs in CI-only mode. Original shard 1194 lines -> 840 (29.6%): 40% target remains unmet. * test: repair d467 fixtures and preserve private-target proof * test: type optional lint fixture lines explicitly
What Problem This Solves
Fixes: a task interrupted by a Gateway restart can only continue in a replacement conversation after automatic recovery gives up.
User Impact
WebChat's Resume continues the saved task in the same session, preserving its identity, workspace, participants, children, and automation bindings. The click supplies current operator authority; it does not restore old approvals or replay completed tool calls. Retry exhaustion leaves the same actionable Resume path.
Resume in new session remains available when a CLI runtime cannot enforce required restart-safe tool restrictions. An already-linked replacement opens that existing session. Pending final delivery must settle first; a missing transcript requires repair.
Why This Change Was Made
The original replacement flow in #122644 (
bb5ef9872a70) avoided resuming a native provider thread with a changed dynamic-tool catalog. The current native runtime can rotate an incompatible provider thread while preserving the OpenClaw session (extensions/codex/src/app-server/thread-lifecycle-run.ts:519). The recovery service's unconditional successor allocation is now limited to the replacement path (src/gateway/session-recovery-service.ts:427).The recovery owner validates the session ID and recovery cycle, then uses ordinary chat admission. The existing input actor accepts the continuation and clears the tombstone in one SQLite transaction (
src/config/sessions/session-pending-input-store.ts:282). No new schema, scheduler, or durable store is introduced. WebChat requests in-place recovery; omitting the new mode preserves the existing public API replacement contract. Existing unknown-outcome guidance and restart-safe tool policy follow the turn through dispatch and queues.The pre-admission recovery-row guard ends after its own successful commit; current operator/source authority and normal admitted-input access checks remain (
src/gateway/server-methods/sessions-recover.ts:60). Otherwise, clearing the tombstone invalidated the new turn before dispatch.Related work reviewed: #172234 (presentation, merged), #165957 (session-controller draft), #166340 and #170336 (restart continuation). This is an adapter at today's recovery/chat owners, with no competing controller.
Evidence
The Team Gateway journal contains six delegated-sender-authority failures at lines 607774, 750589, 798599, 846511, 879013, and 916035. These are sanitized locations only; no message content or session identifiers are included.
Before:
After:
Both captures use inspected synthetic sessions in the Control UI mock harness. The mock E2E also verifies the explicit second-click CLI fallback.
Real-process proof passed 4/4: ordinary permission-change control, managed restart, raw SIGTERM, and SIGKILL with a second restart during the resumed turn. Every restart case reaches final completion in the original session, clears the tombstone, preserves a durably cancelled task, blocks revoked/restricted effects, and checks that completed tool effects occur exactly once. The initial full matrix took 119.539 seconds of test time (605.22 seconds including build). After preserving the stored restriction ceiling, the managed and SIGTERM cases passed again (27.635 and 59.396 seconds); the synthetic provider now deliberately issues a stale execution call when tools are hidden and verifies its rejection. SIGKILL plus the second restart and ordinary permission-control cases also passed in the subsequent CI run. No test timeout was increased.
The probe exposed an existing live-permission bug on clean main (
c3b63ff4c0ec5338d56a4109d2162889db49d653): an ordinary operator turn failed with “Permission change was not authorized by the current operator request.”run/attempt.tsawaited tool reconstruction before recording the authorized change, after its synchronous authorization scope ended. Recording the change before the await fixes the owner without extending authorization lifetime (src/agents/embedded-agent-runner/run/attempt.ts:423); successful acknowledgement still waits for reconstruction.Focused validation
pnpm test test/gateway-session-resume-restart.e2e.test.ts --maxWorkers=1: 4 passed.node scripts/run-vitest.mjs src/gateway/server.sessions.recover-in-place.test.ts --maxWorkers=1: 10 cases passed in the final focused run. Existingserver.sessions.recover.test.ts: 23 passed.queue.authority.test.tsfile passed all 17 cases, including cancellation handoff and both new restart-tool-restriction cases.node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-restart-resume.e2e.test.ts: 2 passed.git diff --checkpassed.check-madge-import-cyclesreports zero cycles. Updated restart-message assertions and the remaining channel-feedback notice. Authority suites passed, sharing-state tests 9/9, model-lock session cases 3/3, delegated shutdown case 1/1, channel-notice suite 8/8. No timeout or safety assertion was weakened. The final Gateway suite passed all 10 cases, including persisted tool restrictions after a successful tool-result tail: restrictions reach native/embedded dispatch and block unsupported CLI continuation. A committed review found this missing retained restriction; the fix matches automatic recovery’s existing safety ceiling. PR review also identified omitted delivery constraints in the full-access exemption; the same automatic-recovery checks now keep media, disabled-message, and suppressed-text restrictions effective, with Gateway rejection proof for all three.pnpm prompt:snapshots:gen, UI English/i18n verification, andpnpm docs:check-links: passed; 15,539 links checked, none broken.Merged main
bd18e16d7de2c4ffd8a2bdaf1b15533dcf094197, including its cancellation-handoff repair. The automatic merge preserves main’s aggregate cancellation owner and disposal unchanged; the onlyqueue/drain.tsdifference from main is propagation offorceRestartSafeToolsandforceCodeModeTools. No manual conflict resolution or new production semantics were introduced.Post-merge validation: queue authority 17/17, Gateway in-place admission 10/10, focused UI 25/25, banner E2E 2/2. Core/UI production and targeted Gateway/messaging, UI-other and banner E2E test typechecks passed; typed lint and formatting passed. The UI-chat graph fails at
ui/src/pages/chat/chat-pane-model-catalog.test.ts:167withTS2304: Cannot find name render. Running the same canonical graph on clean mainbd18e16d7de2c4ffd8a2bdaf1b15533dcf094197reproduces that exact failure; the file is unchanged by this PR. The compiler-inventory test also reproduces on clean main:test/scripts/tsgo-core-test-shards.test.tsstill expectsui/src/components/agent-avatar-face.test.tsafter its rename to.tsx, yieldingexpected [] to deeply equal [ui-components]. Neither failing file is changed by this PR. Final-head CI run 38837406620 completed onc25ebe8a0b86270bf0b8e9a6482d7a51056176ea. Its only failing test is the compiler-inventory assertion above (checks-node-compact-small-1); the aggregate gate is consequently red. The queue-authority failure did not recur, and there are no other failing jobs beyond the aggregate gate. No workflow was rerun.Production: +851 / −389 lines (net +462); tests: +1452 / −42 (net +1410); docs: +25 / −8 (net +17). Most test growth is the real-process restart fixture and Gateway admission regression. Production growth adds the in-place recovery branch and carries existing tool restrictions through normal turn/queue owners. Existing source tracking and error presentation were split by responsibility to keep owner modules within their length limits.