Repository navigation
perf(gateway): skip unrelated inputs during delivery recovery - #173879
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
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. |
|
Landing under the authorized inherited-failure exception for head CI run 38859044898 has two root failures: The remaining selected CI jobs passed, including security-fast. The focused recovery/history tests passed (32 tests); the two required closure guard files passed (21 tests), and the export-name collision guard passed. Independent review is clean. CI was not rerun and is not claimed green. The native merge command stopped before submission because it required a separate PR review worktree. Using the explicitly authorized exact-head merge fallback with the same reviewed head and inherited-failure evidence. |
## What Problem This Solves Routine diagnostic instrumentation builds state and performs message/tool-schema work with no product consumer. The chat pane keeps a separate timing buffer that is only written; the Debug page reads the Gateway event log instead. Agent preparation also recounts compaction messages and serializes tool definitions solely for routine debug summaries. ## User Impact No user-visible behavior, configuration, protocol, or SDK change. Routine successful operations no longer produce the retired trace summaries; operator failures, lifecycle events, and documented slow-stage diagnostics remain available. ## Why This Change Was Made Remove the pane-local timing buffer, correlation map, timing-only paint callback, hydration timing events, and their mechanism-only tests. Keep the real after-paint hydration scheduler, send/progress/request clocks, queue state, recovery, and Gateway timing protocol unchanged. Remove CLI argv/environment/session trace formatting, Decision tool-surface measurement and its first-primary-request observer, compaction debug recounts, the now-orphaned provider routing log formatter, and routine prompt/run/memory-preflight success traces. Authentication/environment policy, Decision pruning, compaction execution, failure logs, OTel IDs/events, and documented slow-stage warnings stay with their existing owners. No config, protocol, SDK, persistence, dependency, or release change. Net production removal: **868 lines** (+4/-872 against the branch base, excluding tests, fixtures, test support, generated files, and declarations). Test reductions only remove assertions for retired instrumentation; retained behavior coverage stays. ## Best-effort tradeoffs accepted - Pane timing history and cross-ACK diagnostic correlation disappear rather than retaining a bounded map for an unread buffer. The latest bound fix [#171146](#171146) describes diagnostic metadata, not an activation/foundation. Actual outbox/progress clocks and Gateway timing fields remain; slow startup remains diagnosed by the Gateway. - CLI per-invocation argv, auth-key-name inventories, and hashed resume summaries are no longer logged. The extracted owner came through [#166711](#166711); its real auth/environment operations remain unchanged. Operators retain failures and existing content-free process outcome metadata. - Decision debug schema-size counters and the first-request observation callback disappear. [#153340](#153340) used the counters for experiment verification; the feature is implemented and its permission/pruning/restoration tests remain. No model quality, token-cost, or performance claim depends on these normalized-character counters. - Compaction no longer walks/re-estimates all messages before and after work just to print debug deltas/top contributors. The extracted diagnostics owner came through [#167325](#167325); real conversation detection, model-call IDs, hooks, failures, fallback warnings, and usage accounting stay. No recovery or durability guard is removed. - Routine successful prompt/run lifecycle and memory preflight traces are quiet. Canonical lifecycle events, failure logs, slow-stage warnings, and actual policy decisions stay. No security, live-authority, concurrency, or data-integrity guard is removed. ## Evidence Initial exact-head CI on b2922ae (run 38857825275) exposed two stale test expectations for the deliberately removed logs. The repair removes only the CLI info-log spy/assertion and the Decision diagnostic-record assertion/setup. All three CLI purposes retain output/trigger/spawn assertions; all four recorded-carrier cases retain request, budget, compaction, usage, and error assertions. No production code changes in this CI repair. Independent P0-P2 review of the complete two-file repair is scoped-clean, with final unchanged-source verification complete; formatting and diff checks pass. | Initial failing job | Attribution | | --- | --- | | checks-node-changed-compact-large-1-1 (116833564544) | Ours: three CLI utility cases asserted the retired trace. Assertions for actual execution remain. | | checks-node-changed-compact-large-1-2 (116833564644) | Ours: two recorded-carrier cases asserted the retired Decision log. All four behavioral combinations remain. | | check-prod-types (116833927964) | Unrelated unused LitContent import in ui/src/pages/chat/chat-view.tsx:16. Identical TS6133 actually reproduced on unrelated PR #173879, head 5ad6fb8, run 38859044898, [job 116838613238](https://github.com/openclaw/openclaw/actions/runs/38859044898/job/116838613238). This PR does not change that file. | | check-lint-core-2 (116833927918) | Same untouched import; identical eslint(no-unused-vars) actually reproduced in the independent run, [job 116838613165](https://github.com/openclaw/openclaw/actions/runs/38859044898/job/116838613165). | | openclaw/ci-gate (116835410676) | Summary of the four jobs above, not a separate product failure. | Focused local replays of the recorded-carrier cases and CLI utility suite were stopped after more than ten minutes without assertion results on the saturated host (exit 143). These are incomplete proof, not passing tests or evidence of a product defect. The fresh suppression run completed with 2 passed / 1 failed: the untouched scripts/lib/control-ui-warm-reload-probe.ts unbound-method allowlist mismatch. Vitest duration 350.15s, wrapper 476.06s; no test, timeout, retry, skip, or suppression change. The next exact-head hosted CI is the broad gate; no CI rerun or unchanged-head push was requested. Independent isolated review completed with no accepted/actionable P0-P2 findings; final unchanged-source verification passed. Exact-head hosted CI is pending. No merge or green CI gate is claimed yet. Completed local boundary proof: nine UI files, 231 tests; provider attribution policy, 19 tests; production core and UI typechecks, exit 0; runtime value cycles: 0; Madge cycles: 0; mock-export and assertion-safety shrink ratchets pass. Every runtime/test command uses a task-owned HOME/OpenClaw/XDG environment. The changed checker completed: core-test graph types (29 graphs), formatting, core lint, UI style checks, cycles and architecture/security guards passed. Its earlier attributable core/UI type and ratchet failures were repaired and those exact gates replayed successfully. Dead-export findings remain in untouched subagent/session/Gateway/UI owners; they are not claimed inherited solely by path. Agent-focused proof remains incomplete: the memory-fallback private-buffer case timed out at 120 seconds; the following usage-accounting case passed at 119 seconds. Host load was about 177 on 16 cores. The task-owned run was stopped rather than extending timeouts or changing tests; no passing or product-defect conclusion is drawn from it. Exact-head CI must cover those agent suites. If CI fails in a changed graph, attribution/replay/drop rules apply. Initial UI fork startup timeout left five files unexecuted, not failed assertions; all five subsequently passed in the recorded focused runs with unchanged timeouts. An initial agent build was invalidated by the orphan-formatter cleanup during artifact preparation; final frozen-source proof replaces that attempt. The local suppression suite reports an untouched warm-reload-probe expected-entry mismatch; the diff adds no suppression. The broad local check also reports an untouched chat-message max-lines suppression against moving main. Neither is represented as a successful gate or an exact-head hosted CI attribution.
## What Problem This Solves Routine diagnostic instrumentation builds state and performs message/tool-schema work with no product consumer. The chat pane keeps a separate timing buffer that is only written; the Debug page reads the Gateway event log instead. Agent preparation also recounts compaction messages and serializes tool definitions solely for routine debug summaries. ## User Impact No user-visible behavior, configuration, protocol, or SDK change. Routine successful operations no longer produce the retired trace summaries; operator failures, lifecycle events, and documented slow-stage diagnostics remain available. ## Why This Change Was Made Remove the pane-local timing buffer, correlation map, timing-only paint callback, hydration timing events, and their mechanism-only tests. Keep the real after-paint hydration scheduler, send/progress/request clocks, queue state, recovery, and Gateway timing protocol unchanged. Remove CLI argv/environment/session trace formatting, Decision tool-surface measurement and its first-primary-request observer, compaction debug recounts, the now-orphaned provider routing log formatter, and routine prompt/run/memory-preflight success traces. Authentication/environment policy, Decision pruning, compaction execution, failure logs, OTel IDs/events, and documented slow-stage warnings stay with their existing owners. No config, protocol, SDK, persistence, dependency, or release change. Net production removal: **868 lines** (+4/-872 against the branch base, excluding tests, fixtures, test support, generated files, and declarations). Test reductions only remove assertions for retired instrumentation; retained behavior coverage stays. ## Best-effort tradeoffs accepted - Pane timing history and cross-ACK diagnostic correlation disappear rather than retaining a bounded map for an unread buffer. The latest bound fix [openclaw#171146](openclaw#171146) describes diagnostic metadata, not an activation/foundation. Actual outbox/progress clocks and Gateway timing fields remain; slow startup remains diagnosed by the Gateway. - CLI per-invocation argv, auth-key-name inventories, and hashed resume summaries are no longer logged. The extracted owner came through [openclaw#166711](openclaw#166711); its real auth/environment operations remain unchanged. Operators retain failures and existing content-free process outcome metadata. - Decision debug schema-size counters and the first-request observation callback disappear. [openclaw#153340](openclaw#153340) used the counters for experiment verification; the feature is implemented and its permission/pruning/restoration tests remain. No model quality, token-cost, or performance claim depends on these normalized-character counters. - Compaction no longer walks/re-estimates all messages before and after work just to print debug deltas/top contributors. The extracted diagnostics owner came through [openclaw#167325](openclaw#167325); real conversation detection, model-call IDs, hooks, failures, fallback warnings, and usage accounting stay. No recovery or durability guard is removed. - Routine successful prompt/run lifecycle and memory preflight traces are quiet. Canonical lifecycle events, failure logs, slow-stage warnings, and actual policy decisions stay. No security, live-authority, concurrency, or data-integrity guard is removed. ## Evidence Initial exact-head CI on b2922ae (run 38857825275) exposed two stale test expectations for the deliberately removed logs. The repair removes only the CLI info-log spy/assertion and the Decision diagnostic-record assertion/setup. All three CLI purposes retain output/trigger/spawn assertions; all four recorded-carrier cases retain request, budget, compaction, usage, and error assertions. No production code changes in this CI repair. Independent P0-P2 review of the complete two-file repair is scoped-clean, with final unchanged-source verification complete; formatting and diff checks pass. | Initial failing job | Attribution | | --- | --- | | checks-node-changed-compact-large-1-1 (116833564544) | Ours: three CLI utility cases asserted the retired trace. Assertions for actual execution remain. | | checks-node-changed-compact-large-1-2 (116833564644) | Ours: two recorded-carrier cases asserted the retired Decision log. All four behavioral combinations remain. | | check-prod-types (116833927964) | Unrelated unused LitContent import in ui/src/pages/chat/chat-view.tsx:16. Identical TS6133 actually reproduced on unrelated PR openclaw#173879, head 5ad6fb8, run 38859044898, [job 116838613238](https://github.com/openclaw/openclaw/actions/runs/38859044898/job/116838613238). This PR does not change that file. | | check-lint-core-2 (116833927918) | Same untouched import; identical eslint(no-unused-vars) actually reproduced in the independent run, [job 116838613165](https://github.com/openclaw/openclaw/actions/runs/38859044898/job/116838613165). | | openclaw/ci-gate (116835410676) | Summary of the four jobs above, not a separate product failure. | Focused local replays of the recorded-carrier cases and CLI utility suite were stopped after more than ten minutes without assertion results on the saturated host (exit 143). These are incomplete proof, not passing tests or evidence of a product defect. The fresh suppression run completed with 2 passed / 1 failed: the untouched scripts/lib/control-ui-warm-reload-probe.ts unbound-method allowlist mismatch. Vitest duration 350.15s, wrapper 476.06s; no test, timeout, retry, skip, or suppression change. The next exact-head hosted CI is the broad gate; no CI rerun or unchanged-head push was requested. Independent isolated review completed with no accepted/actionable P0-P2 findings; final unchanged-source verification passed. Exact-head hosted CI is pending. No merge or green CI gate is claimed yet. Completed local boundary proof: nine UI files, 231 tests; provider attribution policy, 19 tests; production core and UI typechecks, exit 0; runtime value cycles: 0; Madge cycles: 0; mock-export and assertion-safety shrink ratchets pass. Every runtime/test command uses a task-owned HOME/OpenClaw/XDG environment. The changed checker completed: core-test graph types (29 graphs), formatting, core lint, UI style checks, cycles and architecture/security guards passed. Its earlier attributable core/UI type and ratchet failures were repaired and those exact gates replayed successfully. Dead-export findings remain in untouched subagent/session/Gateway/UI owners; they are not claimed inherited solely by path. Agent-focused proof remains incomplete: the memory-fallback private-buffer case timed out at 120 seconds; the following usage-accounting case passed at 119 seconds. Host load was about 177 on 16 cores. The task-owned run was stopped rather than extending timeouts or changing tests; no passing or product-defect conclusion is drawn from it. Exact-head CI must cover those agent suites. If CI fails in a changed graph, attribution/replay/drop rules apply. Initial UI fork startup timeout left five files unexecuted, not failed assertions; all five subsequently passed in the recorded focused runs with unchanged timeouts. An initial agent build was invalidated by the orphan-formatter cleanup during artifact preparation; final frozen-source proof replaces that attempt. The local suppression suite reports an untouched warm-reload-probe expected-entry mismatch; the diff adds no suppression. The broad local check also reports an untouched chat-message max-lines suppression against moving main. Neither is represented as a successful gate or an exact-head hosted CI attribution.
What Problem This Solves
Restart recovery scans unrelated retained pending-input history before activating subagent recovery. The phase named
sidecars.subagent-recoveryincludes savedsessions_sendreplay, so its timing can misleadingly point at the subagent registry.User Impact
Saved peer updates recover with much less discovery and payload work when ordinary or cancelled inputs accumulate. Replay still preserves per-target order, queued-input custody, exact session identity, current communication permissions, and consumption deduplication. No schema, configuration, or retention changes.
Why This Change Was Made
Select unconsumed queued/interrupted inputs bearing saved-delivery metadata inside the existing reader worker, both during session discovery and history paging. Recovery no longer loads unrelated input payloads or computes unused history totals. The delivery owner still validates the metadata and live authority before dispatch.
Ordinary history retains its existing contract, including cancelled messages and total counts. That separate read contract requires a small recovery selector and bounded-page entrypoint; no cache, new worker, or parallel recovery owner is introduced.
Evidence
Two observed restart traces spent at least 12.558/14.287 seconds and 18.087/21.683 seconds before registry activation could begin. These include prewarming, saved-delivery discovery, replay and report writes; the logs alone cannot attribute all elapsed time to the query fixed here.
Synthetic Linux/Node 26 benchmark through the real discovery/history worker owners: 5,000 sessions, 1,000 ordinary interrupted inputs, 15 valid saved peer deliveries, and 40 cancelled inputs per candidate session (41,615 rows). Fresh isolated state; no production data copied.
The warm mean improves 46.9×. A separate full isolated Gateway fixture with 5,000 sessions and 6,000 retained runs took 3.882 seconds for the baseline recovery phase; registry count alone did not reproduce the reported tail. The owner benchmark proves selection cost, not a full production startup after-time. Actual pending-input backlog size is unknown because production access was limited to journal/metrics.
Focused proof: 32 tests passed across
session-entry-recovery.worker.test.ts,session-pending-input-history.test.ts, andsession-send-recovery.test.ts(134.37 seconds wrapper wall time including compiled-worker preparation; recovery test file 3.52 seconds of test bodies). The discovery regression fails against the original query because it includes an unrelated ordinary interrupted input. Existing custody, byte-bound, permission, identity and recovery-retry tests remain green. Changed-file formatting, core-config lint, andgit diff --checkpass; broad typecheck/build/closure gates belong to PR CI. Testbox/Crabbox not used under the lane's validation rule.Review: independent subagent review (autoreview route unavailable), scoped clean through P2. Autoreview preflight refused because its requested provider did not match the operator configuration; no configuration was changed.
Production delta: +45 lines (49 additions, 4 deletions across five production files). Growth preserves the public/general history contract while providing a recovery-only, count-free selection through the same storage owner. The removed work is unrelated session enumeration, payload transport/parse, and repeated totals; no new cache or schema.
PR CI and inherited failures
Exact-head CI run 38859044898 passed the selected test lanes, build, boundary/source guards, test types, and security-fast. The only failed jobs are
check-lint-core-2andcheck-prod-types, both caused by the unusedLitContentimport atui/src/pages/chat/chat-view.tsx:16:10; the CI gate reports their aggregate failure.CI checked out merge
2be0a5c8d774a9b9ab2b53d0531e4f03ceb6a469, with main parent3dc6e49c07fb138c0029a411c1745974f23d144cand PR head5ad6fb8deb9c76a29815ab70c0494dce0bc1c067. The failing file is byte-identical in main parent and tested merge (blobf1b19a7cd92235ea6415244625a624fd4fd3d5de), and a single-file oxlint run on the baseline file reproduces the same unused-import error. The sole occurrence ofLitContentis its import. This PR touches only the seven recovery files and does not alter UI or lint/type configuration. The automated classification called these failures new relative to an older scheduled main run; the exact tested-parent evidence establishes them as inherited. No CI reruns or unrelated repairs were added.Landing uses the authorized inherited-failure exception; CI is not claimed green.