Skip to content

fix: active tool sessions report idle after steering - #194907

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-long-running-session-idle-with-active-tool-20260919
Nov 8, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-long-running-session-idle-with-active-tool-20260919

Conversation

@steipete

@steipete steipete commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes diagnostics reporting an idle session while its run is still executing a tool, after a steering message finishes dispatching or falls back to the follow-up queue.

User Impact

Long-running-session logs and diagnostic events retain processing with activeWorkKind=tool_call during active execution. Queue accounting still consumes the completed dispatch without counting the active original input as backlog. No configuration or migration is required.

Why This Change Was Made

Message completion was unconditionally publishing session idle. The message-lifecycle producer now shares its existing controller lookup between arrival and completion, while the diagnostic writer can consume the completed input independently of the published state. Controller retirement remains authoritative. Production code grows by two lines to separate message accounting from run state, with no new cache or scan.

The Control UI uses a separate run projection and pending-input capability, so no UI production change is needed. A mocked-Gateway regression verifies a 215-second active exec with a 30-second pending steer shows Stop and Send now, and targets the exact input. The existing 120-second transcript-commit timeout can withdraw a steer and remove its Send now capability after follow-up fallback; this PR does not change that policy.

Related: #193665. Complements #194805 without changing its files or presentation.

Evidence

The heartbeat regression fails on base ec41ea83a44cf84f2cdc1cf4a7d7b0983523952c with state=idle activeTool=exec reason=tool_execution_wait, then passes with correct processing state and backlog. Focused core tests: 46 passed (new regression 21 ms). UI E2E: 12 passed (18.294 s test time); the final fixture rerun passed in 996 ms. Component/access and Chromium sidebar tests: 40 passed (7.05 s). CI duration is pending.

Codex autoreview of the complete local change against that base: P0–P2 scoped-clean, no actionable findings (fresh review after the gate-driven correction). The test-line allocation covers exactly 134 new lines for the distinct diagnostic-owner and browser contracts; the benchmark adds 185 proof-only lines.

check:changed completed red. It caught a patch-local import cycle and test lint pattern, both repaired; final targeted lint/types/format and cycle checks pass. Remaining main regressions: 20 historical attribution violations introduced by 266a7aa0fe69 (#194364), unused OpenClawShell reported after adca0b0844c7 (#194815), and unused CommandPaletteOpenDetail introduced by 9151ac22e005. All reproduce on the exact base; the two Knip reproductions reuse the existing same-base lane proof. No overall green or guard exception is claimed.

The committed scripts/perf/diagnostic-state-measure.ts uses 4,096 resident controller identities, 2,000 diagnostic entries, an outstanding exec and one queued input. Each measured steer constructs a fresh message lifecycle. Four A/A controls, five interleaved before/after pairs, separate allocation passes and CPU profiles cover two million dispatches. Every queue-count assertion passed; incorrect idle observations fell from every baseline sample to zero.

Warm owner dispatch Before After
Median / p95 833 / 1,083 ns 1,250 / 1,458 ns
CPU per dispatch 1,394 ns 1,776 ns
Sampled allocation per dispatch 2,789 B 4,122 B

This is a correctness cost, not a speedup: the additional indexed lookup and shared lifecycle helper add 417 ns median, approximately 0.38 microseconds CPU and 1.3 KB sampled allocation per steer. Median increases 50.06%, CPU 27.35%, allocation 47.82%; these exceed A/A variation and are retained as a small absolute per-message correctness cost. All five paired CPU changes were positive; A/A CPU ranged 139.161–146.594 ms per 100,000 actions. The benchmark excludes import/setup, diagnostic subscribers, database/workspace I/O, transport and real tool/provider execution. It makes no cold-start or full-Gateway performance claim. No live deployment was accessed.

Keep message completion separate from run state by sharing the message lifecycle controller lookup between arrival and completion. Consume the completed input without retiring a still-running tool owner. Cover the diagnostic heartbeat, queue accounting, and existing Send now affordance; retain timeout and UI presentation policy.
@clawsweeper

clawsweeper Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui scripts Repository scripts size: M labels Nov 8, 2026
@steipete
steipete marked this pull request as ready for review November 8, 2026 01:15
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T01:18:01.315494Z 58f88a3 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete merged commit ee3ec60 into main Nov 8, 2026
197 of 201 checks passed
@steipete
steipete deleted the steipete/perf-micro-long-running-session-idle-with-active-tool-20260919 branch November 8, 2026 01:26
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 8, 2026
Keep message completion separate from run state by sharing the message lifecycle controller lookup between arrival and completion. Consume the completed input without retiring a still-running tool owner. Cover the diagnostic heartbeat, queue accounting, and existing Send now affordance; retain timeout and UI presentation policy.
roboclaw-bot added a commit that referenced this pull request Nov 8, 2026
Preserve the processing and queue-consumption contract introduced by #194907. Assert controller retirement ordering and inject finalization failure at message completion while retaining rejection and admission-release checks.

Co-authored-by: steipete <[email protected]>
steipete added a commit that referenced this pull request Nov 8, 2026
Preserve the processing and queue-consumption contract introduced by #194907. Assert controller retirement ordering and inject finalization failure at message completion while retaining rejection and admission-release checks.

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: steipete <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 9, 2026
…#195026)

Preserve the processing and queue-consumption contract introduced by openclaw#194907. Assert controller retirement ordering and inject finalization failure at message completion while retaining rejection and admission-release checks.

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: steipete <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant