Repository navigation
Conversation
Tap the existing agent-driver onOutput stream and re-emit each chunk as a new "activity" ProgressCallback event, throttled to ~10 Hz to preserve the TUI's poll budget. RunOrchestrator strips ANSI, picks the last non-empty line, updates nowLine + lastActivityAt, and substitutes the coarse 'running <phase>' form when activity goes stale for >=5s. Implements option (b) from the issue — using the in-process stream rather than tailing a non-existent log file.
4 tasks
…, filter test QA on PR #629 surfaced four gap-fix opportunities. Bundled here: 1. Extract `createThrottledReporter(fn, intervalMs)` in phase-executor.ts: leading + trailing edge throttle replacing the inline leading-only closure. Latest payload during a throttle window is stashed and fires ~100ms after the burst ends, so the TUI cell no longer goes stale (until the 5s coarse fallback) just because the last useful chunk landed inside the 100ms window. Adds `cancel()` for cleanup after `driver.executePhase` returns. 2. Broaden the ANSI strip in `extractActivityLine` from SGR-only (\x1b\[[0-9;]*m) to all CSI sequences (\x1b\[[0-9;?]*[a-zA-Z]). Covers cursor moves (\x1b[G), line clears (\x1b[2K), and DEC private-mode toggles (\x1b[?25l) that can leak through chalk/ink in agent output. 3. Add 6 unit tests for `createThrottledReporter` (leading fires, within-window drop with latest-stash, trailing fire of latest, no trailing when idle, idle-window leading resume, cancel drops pending) using vitest fake timers. Makes the throttle behavior — which carries AC-3 — directly verifiable instead of relying on the public `applyProgressEvent` surface to exercise it transitively. 4. Add 2 tests in the new src/commands/run-progress.test.ts covering the activity-event filter on both the renderer and `-q` heartbeat branches. If the two-line `if (event === "activity") return` guards are ever removed, the non-TUI line renderer would spam ~10 lines/sec per active phase — these tests catch that regression. 5. Add 1 test in run-state.test.ts asserting non-SGR CSI escapes are stripped. All 2664 tests pass (was 2655 — exactly 9 new). Lint clean. Build clean. Verdict in the QA comment moves from READY_FOR_MERGE-with-non-blocking- nits to READY_FOR_MERGE-with-no-known-gaps.
admarble
added a commit
that referenced
this pull request
Sep 9, 2026
…, filter test QA on PR #629 surfaced four gap-fix opportunities. Bundled here: 1. Extract `createThrottledReporter(fn, intervalMs)` in phase-executor.ts: leading + trailing edge throttle replacing the inline leading-only closure. Latest payload during a throttle window is stashed and fires ~100ms after the burst ends, so the TUI cell no longer goes stale (until the 5s coarse fallback) just because the last useful chunk landed inside the 100ms window. Adds `cancel()` for cleanup after `driver.executePhase` returns. 2. Broaden the ANSI strip in `extractActivityLine` from SGR-only (\x1b\[[0-9;]*m) to all CSI sequences (\x1b\[[0-9;?]*[a-zA-Z]). Covers cursor moves (\x1b[G), line clears (\x1b[2K), and DEC private-mode toggles (\x1b[?25l) that can leak through chalk/ink in agent output. 3. Add 6 unit tests for `createThrottledReporter` (leading fires, within-window drop with latest-stash, trailing fire of latest, no trailing when idle, idle-window leading resume, cancel drops pending) using vitest fake timers. Makes the throttle behavior — which carries AC-3 — directly verifiable instead of relying on the public `applyProgressEvent` surface to exercise it transitively. 4. Add 2 tests in the new src/commands/run-progress.test.ts covering the activity-event filter on both the renderer and `-q` heartbeat branches. If the two-line `if (event === "activity") return` guards are ever removed, the non-TUI line renderer would spam ~10 lines/sec per active phase — these tests catch that regression. 5. Add 1 test in run-state.test.ts asserting non-SGR CSI escapes are stripped. All 2664 tests pass (was 2655 — exactly 9 new). Lint clean. Build clean. Verdict in the QA comment moves from READY_FOR_MERGE-with-non-blocking- nits to READY_FOR_MERGE-with-no-known-gaps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
onOutputstream to enrich the multi-issue TUI'snowline with sub-phase activity, replacing the coarserunning <phase>placeholder from Live multi-issue dashboard forsequant run— concurrent box rendering (read-only TUI) #540."activity"variant toProgressCallback;RunOrchestratorstrips ANSI, takes the last non-empty line, updatesnowLine+lastActivityAt, and substitutes the coarse form when activity is ≥5s stale..sequant/logs/<issue>-<phase>.logfiles were assumed by the issue but never existed (.sequant/logs/holds aggregate run JSON only).Implementation notes
withActivityHook(config, issue, phase, onProgress)helper inbatch-executorwrapsExecutionConfigwith anonActivityadapter at eachexecutePhaseWithRetrycall site; runs without a TUI pay no overhead because the helper short-circuits whenonProgressis undefined.-qheartbeat inrun-progress.tsfilter"activity"events out — they only feed the TUI'snowLine.Pre-PR AC Verification
currentPhase.nowLinesurfaces sub-phase activityrun-orchestrator.ts:262-273(activity event handler);phase-executor.ts:617-637(onActivity wiring)lastActivityAtadvances when signal changesrun-orchestrator.ts:270—lastActivityAt = new Date()on every accepted activity eventphase-executor.ts:625-636—ACTIVITY_THROTTLE_MS = 100coalesces driver pings; getSnapshot still allocates plain objects per AC-3 expectationsrunning <phase>after ≥5s of no activityrun-orchestrator.ts:1052-1059—nowLineWithStaleFallback()invoked fromcloneIssueStateso every snapshot read enforces the thresholdTest plan
npm run build— cleannpm run lint— clean (no warnings)npx vitest run src/— 2655/2655 passing across 103 filesrun-state.test.tscovering activity nowLine updates, multi-line chunk handling, ANSI stripping, stale-phase race ignore, empty-text no-op, and 5s coarse fallbackbatch-executor.test.tscoveringwithActivityHook(undefined passthrough, event forwarding, error swallowing)lastActivityAt)Closes #543