You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(tui): enrich nowLine with per-file / log-tail activity #543
#540 shipped the experimental multi-issue TUI dashboard (M1). The now line in IssueBox is phase-coarse — running <phase> — because the existing onProgress event is the only available signal.
Spec Open Question #1 for #540 enumerated three options; M1 shipped (a). This issue tracks (b) and/or (c).
Options
(b) Log-tail enrichment
Tail .sequant/logs/<issue>-<phase>.log at the polling cadence (10 Hz). Update currentPhase.nowLine to the last log line; update currentPhase.lastActivityAt to the log file mtime. Bounded by a short head-truncation to keep reads cheap.
(c) Structured activity hook
Instrument the Claude CLI / agent driver to emit structured activity events (file edits, tool calls). Route through RunOrchestrator.wrapProgress to populate currentPhase directly.
Acceptance Criteria
currentPhase.nowLine surfaces sub-phase activity (option b or c)
currentPhase.lastActivityAt advances when the underlying signal changes (so the "last activity Xs ago" stamp actually ticks)
Polling overhead stays within the existing 10 Hz budget
When no activity is observed for ≥5s, the line falls back to the coarse running <phase> rather than going blank
→ PARK — Author-intended backlog per body (label not yet applied). Follow-on to experimental M1 TUI from #540/#542.
Resume after: M1 TUI graduates from experimental, or user decides to advance.
Consider: `gh issue edit 543 --add-label backlog` to match the stated intent.
→ PARK — Author-intended backlog per body; follow-on to experimental M1 TUI from #540/#542
Resume after: M1 TUI graduates from experimental, or user decides to advance
Cleanup: gh issue edit 543 --add-label backlog to match stated intent.
Heads-up: #624 (run renderer follow-ups) overlaps with this issue.
#624 item 1 imposes a height cap on the live zone (max(8, process.stdout.rows - 5)), and #624 item 3 adds loop N/M · last fail: <reason> to the live-zone status cell. Both touch the same data model that this issue's nowLine enrichment would extend.
Whoever picks up either issue should read the other first to avoid reshaping the live-zone layout twice. Easiest path may be to fold this into #624's scope as a coherent live-zone redesign — worth a design discussion before either is assigned.
→ PARK — Author-intended backlog; M1 TUI from #540 still experimental. New signal: #624 (run renderer follow-ups, opened today) touches the same live-zone data model — item 3 of #624 adds `loop N/M · last fail: ` to the status cell, which is exactly the nowLine enrichment surface.
Resume after: M1 TUI graduates from experimental, OR #624 lands and a coherent live-zone redesign can be planned on top of the new shape.
Cleanup: `gh issue edit 543 --add-label backlog` to match stated intent.
PR: #629 — feat(#543): enrich TUI nowLine with sub-phase activity from agent stream
AC Coverage
AC
Description
Status
Evidence
AC-1
currentPhase.nowLine surfaces sub-phase activity (option b or c)
✅ Implemented
run-orchestrator.ts activity event handler (applyProgressEvent); phase-executor.ts wires the agent driver's onOutput stream through ExecutionConfig.onActivity
AC-2
lastActivityAt advances when the underlying signal changes
✅ Implemented
lastActivityAt = new Date() on every accepted activity event
AC-3
Polling overhead stays within the existing 10 Hz budget
✅ Implemented
ACTIVITY_THROTTLE_MS = 100 in phase-executor coalesces driver pings before re-emit; getSnapshot still returns freshly-allocated plain objects
AC-4
Coarse running <phase> fallback after ≥5s of no activity
✅ Implemented
nowLineWithStaleFallback() runs on every cloneIssueState call, so the threshold is enforced declaratively per snapshot read
Implementation Notes (vs the issue body)
The issue describes option (b) as "tail .sequant/logs/<issue>-<phase>.log", but those files don't exist in this codebase — .sequant/logs/ only holds aggregate run JSON (run-*.json). Per-issue stdout transcripts live at /tmp/claude-issue-<N>.log (hook-managed). I implemented option (b)'s intent using the already-existing in-process onOutput stream from ClaudeCodeDriver, which is functionally equivalent but cheaper and avoids re-tailing what we already have in memory.
Option (c) (instrument the driver for structured events) was not needed — the existing stream is sufficient for nowLine. If finer signals (file edits, tool calls) are ever wanted, a derived AC for arch: typed workflow event system for decoupled progress, logging, and MCP streaming #504 would extend onActivity payloads without changing the orchestrator side.
#624 landed before this PR and shaped the RunRenderer live-zone status cell, but this work touches a different layer: the multi-issue TUI (src/ui/tui/) consumes currentPhase.nowLine from RunOrchestrator.getSnapshot(), while #624's renderer reads the same ProgressCallback stream directly. Activity events are filtered out of the non-TUI line renderer (run-progress.ts) so #624's display is unaffected.
Files Changed
src/lib/workflow/types.ts — extend ProgressCallback event union + add ExecutionConfig.onActivity
src/lib/workflow/phase-executor.ts — wire onOutput → config.onActivity with 100ms throttle
src/lib/workflow/batch-executor.ts — withActivityHook() adapter; applied at 3 phase call sites
src/commands/run-progress.ts — filter activity events out of the non-TUI renderer/heartbeat
src/lib/workflow/run-state.test.ts — 6 new test cases (activity flow, ANSI strip, multi-line, stale fallback, etc.)
src/lib/workflow/batch-executor.test.ts — 3 new test cases for withActivityHook
CHANGELOG.md — [Unreleased] entry
Quality Gates
npm run build: ✅ pass
npm run lint: ✅ pass (0 warnings)
npx vitest run src/: ✅ 2655/2655 passing across 103 files
Quality Plan Alignment
N/A — no /spec was run for this issue (the implementation followed the issue's own AC list directly). Worth noting if a future review wants /spec-driven derived ACs.
Known Gaps / Follow-ups
The phase-executor.ts plumbing (config.onActivity wired to onOutput) is exercised end-to-end through the orchestrator unit tests and a manual smoke test, but lacks a dedicated unit test that mocks AgentDriver. Reasoning: the wiring is ~5 lines around an existing callback path; a direct test would be heavy on mocks for marginal regression value, and the withActivityHook adapter + applyProgressEvent activity branch are both covered.
currentPhase.nowLine surfaces sub-phase activity (option b or c)
✅ MET
applyProgressEvent handles new "activity" event variant; phase-executor taps the existing onOutput stream and re-emits through ExecutionConfig.onActivity. Implements option (b)'s intent over the in-process agent stream — the issue body assumes .sequant/logs/<issue>-<phase>.log files exist but they don't (only aggregate run-*.json); the in-memory stream is functionally equivalent and cheaper. Documented clearly in the PR description.
AC-2
Original
lastActivityAt advances when the underlying signal changes
✅ MET
state.currentPhase.lastActivityAt = new Date() set on every accepted activity event (run-orchestrator.ts:276). Verified by run-state.test.ts "updates nowLine and lastActivityAt on activity events".
AC-3
Original
Polling overhead stays within the existing 10 Hz budget
✅ MET
ACTIVITY_THROTTLE_MS = 100 (phase-executor.ts:623) coalesces driver pings to ≤10 Hz before re-emit. getSnapshot() still returns freshly-allocated plain objects; no extra work per poll on the read side.
AC-4
Original
When no activity is observed for ≥5s, fall back to coarse running <phase> rather than going blank
✅ MET
nowLineWithStaleFallback() runs on every cloneIssueState (run-orchestrator.ts:1056); when ageMs ≥ ACTIVITY_STALE_MS (5000) it returns formatCoarseNowLine(phase). Declarative per snapshot read — no timer churn. lastActivityAt preserved so the "Xs ago" stamp continues to tick.
Coverage: 4/4 AC items fully met Original ACs: 4/4 met Derived ACs: N/A — no /spec was run for this issue.
Quality Plan Verification
N/A — No quality plan found in issue comments.
CI Status
Check
State
Bucket
Impact
build (20.x)
SUCCESS
pass
✅ MET
build (22.x)
SUCCESS
pass
✅ MET
typecheck
SUCCESS
pass
✅ MET
validate-skills
SUCCESS
pass
✅ MET
validate-plugin
SUCCESS
pass
✅ MET
CI Summary: 5 passed, 0 pending, 0 failed
Stale Branch Check
Check
Value
Commits behind origin/main
0
Threshold
5
Status
✅ OK
Quality Metrics
Metric
Value
Status
Type issues (new any / as any)
0
OK
Deleted tests
0
OK
Files changed
8
OK
Lines added
+290
-
Lines deleted
-17
-
Build Verification
N/A — Build passes locally and in CI.
Test Coverage Analysis
Changed File
Tier
Has Tests?
Test File
src/lib/workflow/types.ts
Optional (types-only)
N/A (no runtime logic)
-
src/lib/workflow/run-orchestrator.ts
Standard
✅ Yes
src/lib/workflow/run-state.test.ts (+7 new cases)
src/lib/workflow/phase-executor.ts
Standard
⚠️ Transitive
Wiring (~5 lines around existing onOutput callback); covered by integration through orchestrator tests. Author flagged this gap in PR body with clear cost-benefit reasoning.
src/lib/workflow/batch-executor.ts
Standard
✅ Yes
src/lib/workflow/batch-executor.test.ts (+3 new cases for withActivityHook)
src/commands/run-progress.ts
Standard
⚠️ Two-line filter (if (event === "activity") return); behavior is "don't break non-TUI renderer" — trivially verified by existing tests not failing.
CHANGELOG.md
Optional
N/A
-
Coverage: Core behavior (4/4 ACs) fully covered by 9 new tests. Thin wiring layers (phase-executor onActivity throttle + run-progress filter) covered transitively; explicit cost-benefit waiver documented in PR body is reasonable per feedback_evaluate_gaps_before_fixing.md. Critical paths without tests: None.
Targeted test run: 51/51 passing in run-state.test.ts + batch-executor.test.ts (3.41s). Full suite (per PR body): 2655/2655 across 103 files.
Code Review
Strengths:
Clean separation of concerns. Activity event is a new ProgressCallback variant — orchestrator updates state; non-TUI renderers filter it out at the boundary (run-progress.ts). No layering violation.
Throttle implemented at the right layer.ACTIVITY_THROTTLE_MS = 100 lives in phase-executor (per-phase scope, not global), matching the 10 Hz TUI poll budget exactly. Errors in the activity callback are swallowed so the run is never disrupted.
Stale fallback is declarative, not timer-driven.nowLineWithStaleFallback is computed at snapshot-read time — no setInterval, no race risk. Preserves lastActivityAt so the "Xs ago" stamp still ticks even in coarse mode.
Race guard.applyProgressEvent ignores activity events for stale phase names (test "ignores activity events for stale phase names"), correctly handling the race between completion and a final flushed chunk.
Zero overhead when off.withActivityHook returns the input config unchanged when onProgress is undefined — non-TUI runs pay nothing.
Honest divergence note. PR description explicitly explains why option (b)'s "tail .sequant/logs/-.log" was implemented over the in-process stream instead (those log files don't exist in this codebase).
CHANGELOG entry is detailed and accurate.
Issues: None blocking.
Suggestions (non-blocking):
Trailing-edge throttle drop. The 100ms throttle is leading-edge — if a final useful output chunk arrives within 100ms of the previous emit and activity then stops, that line is lost and the cell falls back to coarse after 5s. Minor UX wart; the 5s fallback masks it. Not worth fixing.
extractActivityLine only strips SGR escapes (\x1b\[[0-9;]*m). Cursor-movement / clear-screen sequences would pass through. Almost certainly fine for typical agent output, but a follow-up could broaden the regex if real output proves noisy.
Test Quality Review
Category
Status
Notes
Behavior vs Implementation
✅ OK
Tests assert on observable snapshot state (getSnapshot().issues[0].currentPhase.nowLine), not internals.
No mocks needed in run-state.test.ts — drives via the public onProgress callback. batch-executor.test.ts uses minimal vi.fn() for callback assertion.
Test Reliability
✅ OK
One 5ms setTimeout to ensure Date.now() advances ≥1ms — narrow and necessary. Forced clock manipulation (new Date(Date.now() - 6_000)) used for the stale-fallback test, avoiding real sleep.
Anti-Pattern Detection
Dependency Audit
N/A — No package.json changes.
Code Patterns
No new anti-patterns introduced. No any / as any additions in source files. No empty catch blocks for control flow — the two try { onActivity(text) } catch {} swallows are intentional and documented (activity reporting must never disrupt the run). No N+1, no hardcoded secrets, no SQL.
All three executePhaseWithRetry invocations wrapped consistently
✅ Covers all phases (spec, main, loop) — matches AC-1's "sub-phase activity" requirement across the full phase set
Findings: All executePhaseWithRetry call sites are wrapped. No phase emits agent output without the activity hook attached.
CLI Registration Verification
N/A — No RunOptions changes. The new onActivity?: (text: string) => void lives on ExecutionConfig (internal config), not RunOptions. No user-facing CLI flag needed.
Execution Evidence
N/A — No scripts/ or CLI command changes. This is a library-internal wiring change consumed transitively by the experimental TUI (--experimental-tui already exists).
Skill Command Verification
N/A — No .claude/skills/**/*.md files changed.
Smoke Test
N/A — No workflow-affecting changes (skills, scripts, CLI). The behavior change is internal to the multi-issue TUI rendering path; the existing --experimental-tui flag exercises it.
docs/features/experimental-tui-dashboard.md already documents the target behavior — the example at line 51 shows now ⠙ writing src/blog/pagination.tsx followed by last activity 00:02s ago. Before this PR, that example was aspirational (the M1 TUI only rendered the coarse running <phase> form per the issue body). This PR makes the example accurate without docs changes. No update needed.
Self-Evaluation
Verified working: Yes — ran the targeted test files (51/51 passing in 3.41s) and traced the full activity event path inline: agent driver onOutput → phase-executor 100ms throttle → config.onActivity → withActivityHook → ProgressCallback("activity") → RunOrchestrator.applyProgressEvent → state.currentPhase → cloneIssueState snapshot with nowLineWithStaleFallback.
Test efficacy: High — the 9 new tests assert on the AC space directly (nowLine updates, lastActivityAt advances, 5s stale fallback, plus 4 edge cases) and exercise the public ProgressCallback surface.
Likely failure mode: Trailing-edge throttle drop — if a final useful output chunk arrives within 100ms of the previous emit and the agent then goes silent, that line is lost. The 5s coarse-fallback masks it gracefully. Not a correctness bug.
Verdict confidence: High. Small, focused change (8 files, +290/-17), all 4 ACs literally met, all 5 CI checks green, no new any types, lint clean, branch in sync with main.
Verdict: READY_FOR_MERGE
A+ implementation. All four acceptance criteria are literally met, the change is well-scoped (8 files, +290/-17), tests cover the AC space with 9 new cases, CI is fully green, and the PR description honestly documents one design deviation from the issue body (option b implemented over the in-process agent stream instead of tailing nonexistent .sequant/logs/<issue>-<phase>.log files) with sound reasoning.
Documentation
Before merging, run /docs 543 to refresh docs/features/experimental-tui-dashboard.md if you want to document the new fall-back-to-coarse-after-5s behavior beyond the existing example (optional — current docs are not misleading).
Commit d051c92 (on top of ee994bb) closes the four non-blocking gaps from the prior QA review.
What changed
Gap
Fix
Throttle in phase-executor.ts had no direct test
Extracted createThrottledReporter(fn, intervalMs) as a pure, exported helper with leading + trailing throttle (was leading-only). Replaces the inline closure.
Trailing-edge throttle drop
Same helper — the latest payload during a window is now stashed and fires ~100ms after the burst ends, so the cell no longer goes stale until the 5s coarse fallback.
extractActivityLine only stripped SGR escapes
Broadened regex from \x1b\[[0-9;]*m to \x1b\[[0-9;?]*[a-zA-Z] — now strips all CSI sequences (cursor moves, line clears, DEC private-mode toggles).
run-progress.ts activity filter had no test
New src/commands/run-progress.test.ts with two tests covering the filter for both the renderer and -q heartbeat branches.
Test delta
+9 tests, all passing (was 2655 → 2664 in src/):
6 cases 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.
1 case in run-state.test.ts asserting non-SGR CSI escapes (\x1b[2K\x1b[G\x1b[?25l…) are stripped.
2 cases in src/commands/run-progress.test.ts for the activity-event filter.
Lint: clean.
Build (tsc): clean.
CI: all 5 checks green on d051c92 (build 20.x / 22.x, typecheck, validate-skills, validate-plugin).
Behavior shift
User-visible: the experimental TUI's now line will reflect one final activity ping ~100ms after a burst of agent output ends, instead of going stale until the 5s coarse fallback. AC-3 (≤10 Hz poll budget) preserved — the throttle still emits at most 2 fires per 100ms window.
Updated verdict
READY_FOR_MERGE — no known gaps remaining. CHANGELOG entry refreshed in the same commit to reflect the new throttle and ANSI behavior.
Activity
fix(#540): QA gaps — tees + SIGINT unmount
feat(#540): experimental multi-issue TUI dashboard for `sequant run` (#…
admarble commentedon Apr 23, 2026
→ PARK — Author-intended
backlogper body (label not yet applied). Follow-on to experimental M1 TUI from #540/#542.Resume after: M1 TUI graduates from experimental, or user decides to advance.
Consider: `gh issue edit 543 --add-label backlog` to match the stated intent.
admarble commentedon Apr 26, 2026
→ PARK — Author-intended
backlogper body; follow-on to experimental M1 TUI from #540/#542Resume after: M1 TUI graduates from experimental, or user decides to advance
Cleanup:
gh issue edit 543 --add-label backlogto match stated intent.admarble commentedon May 11, 2026
Heads-up: #624 (run renderer follow-ups) overlaps with this issue.
#624 item 1 imposes a height cap on the live zone (
max(8, process.stdout.rows - 5)), and #624 item 3 addsloop N/M · last fail: <reason>to the live-zone status cell. Both touch the same data model that this issue'snowLineenrichment would extend.Whoever picks up either issue should read the other first to avoid reshaping the live-zone layout twice. Easiest path may be to fold this into #624's scope as a coherent live-zone redesign — worth a design discussion before either is assigned.
admarble commentedon May 11, 2026
Supersedes 2 prior assessments (most recent: 2026-04-26)
→ PARK — Author-intended backlog; M1 TUI from #540 still experimental. New signal: #624 (run renderer follow-ups, opened today) touches the same live-zone data model — item 3 of #624 adds `loop N/M · last fail: ` to the status cell, which is exactly the nowLine enrichment surface.
Resume after: M1 TUI graduates from experimental, OR #624 lands and a coherent live-zone redesign can be planned on top of the new shape.
Cleanup: `gh issue edit 543 --add-label backlog` to match stated intent.
admarble commentedon May 11, 2026
/exec Progress Update
PR: #629 — feat(#543): enrich TUI nowLine with sub-phase activity from agent stream
AC Coverage
currentPhase.nowLinesurfaces sub-phase activity (option b or c)run-orchestrator.tsactivity event handler (applyProgressEvent);phase-executor.tswires the agent driver'sonOutputstream throughExecutionConfig.onActivitylastActivityAtadvances when the underlying signal changeslastActivityAt = new Date()on every accepted activity eventACTIVITY_THROTTLE_MS = 100in phase-executor coalesces driver pings before re-emit; getSnapshot still returns freshly-allocated plain objectsrunning <phase>fallback after ≥5s of no activitynowLineWithStaleFallback()runs on everycloneIssueStatecall, so the threshold is enforced declaratively per snapshot readImplementation Notes (vs the issue body)
.sequant/logs/<issue>-<phase>.log", but those files don't exist in this codebase —.sequant/logs/only holds aggregate run JSON (run-*.json). Per-issue stdout transcripts live at/tmp/claude-issue-<N>.log(hook-managed). I implemented option (b)'s intent using the already-existing in-processonOutputstream fromClaudeCodeDriver, which is functionally equivalent but cheaper and avoids re-tailing what we already have in memory.nowLine. If finer signals (file edits, tool calls) are ever wanted, a derived AC for arch: typed workflow event system for decoupled progress, logging, and MCP streaming #504 would extendonActivitypayloads without changing the orchestrator side.Heads-up on overlap with #624
#624 landed before this PR and shaped the
RunRendererlive-zone status cell, but this work touches a different layer: the multi-issue TUI (src/ui/tui/) consumescurrentPhase.nowLinefromRunOrchestrator.getSnapshot(), while #624's renderer reads the sameProgressCallbackstream directly. Activity events are filtered out of the non-TUI line renderer (run-progress.ts) so #624's display is unaffected.Files Changed
src/lib/workflow/types.ts— extendProgressCallbackevent union + addExecutionConfig.onActivitysrc/lib/workflow/run-orchestrator.ts— activity event handler, stale fallback, ANSI strip + last-line extractionsrc/lib/workflow/phase-executor.ts— wireonOutput→config.onActivitywith 100ms throttlesrc/lib/workflow/batch-executor.ts—withActivityHook()adapter; applied at 3 phase call sitessrc/commands/run-progress.ts— filter activity events out of the non-TUI renderer/heartbeatsrc/lib/workflow/run-state.test.ts— 6 new test cases (activity flow, ANSI strip, multi-line, stale fallback, etc.)src/lib/workflow/batch-executor.test.ts— 3 new test cases forwithActivityHookCHANGELOG.md— [Unreleased] entryQuality Gates
npm run build: ✅ passnpm run lint: ✅ pass (0 warnings)npx vitest run src/: ✅ 2655/2655 passing across 103 filesQuality Plan Alignment
N/A — no
/specwas run for this issue (the implementation followed the issue's own AC list directly). Worth noting if a future review wants/spec-driven derived ACs.Known Gaps / Follow-ups
phase-executor.tsplumbing (config.onActivitywired toonOutput) is exercised end-to-end through the orchestrator unit tests and a manual smoke test, but lacks a dedicated unit test that mocksAgentDriver. Reasoning: the wiring is ~5 lines around an existing callback path; a direct test would be heavy on mocks for marginal regression value, and thewithActivityHookadapter +applyProgressEventactivity branch are both covered.admarble commentedon May 12, 2026
QA Review for Issue #543
PR: #629 —
feat(#543): enrich TUI nowLine with sub-phase activity from agent streamCommit reviewed:
ee994bbBranch: 0 commits behind
origin/main✅AC Coverage
currentPhase.nowLinesurfaces sub-phase activity (option b or c)applyProgressEventhandles new"activity"event variant;phase-executortaps the existingonOutputstream and re-emits throughExecutionConfig.onActivity. Implements option (b)'s intent over the in-process agent stream — the issue body assumes.sequant/logs/<issue>-<phase>.logfiles exist but they don't (only aggregaterun-*.json); the in-memory stream is functionally equivalent and cheaper. Documented clearly in the PR description.lastActivityAtadvances when the underlying signal changesstate.currentPhase.lastActivityAt = new Date()set on every accepted activity event (run-orchestrator.ts:276). Verified byrun-state.test.ts"updates nowLine and lastActivityAt on activity events".ACTIVITY_THROTTLE_MS = 100(phase-executor.ts:623) coalesces driver pings to ≤10 Hz before re-emit.getSnapshot()still returns freshly-allocated plain objects; no extra work per poll on the read side.running <phase>rather than going blanknowLineWithStaleFallback()runs on everycloneIssueState(run-orchestrator.ts:1056); whenageMs ≥ ACTIVITY_STALE_MS (5000)it returnsformatCoarseNowLine(phase). Declarative per snapshot read — no timer churn.lastActivityAtpreserved so the "Xs ago" stamp continues to tick.Coverage: 4/4 AC items fully met
Original ACs: 4/4 met
Derived ACs: N/A — no
/specwas run for this issue.Quality Plan Verification
N/A — No quality plan found in issue comments.
CI Status
build (20.x)build (22.x)typecheckvalidate-skillsvalidate-pluginCI Summary: 5 passed, 0 pending, 0 failed
Stale Branch Check
Quality Metrics
any/as any)Build Verification
N/A — Build passes locally and in CI.
Test Coverage Analysis
src/lib/workflow/types.tssrc/lib/workflow/run-orchestrator.tssrc/lib/workflow/run-state.test.ts(+7 new cases)src/lib/workflow/phase-executor.tsonOutputcallback); covered by integration through orchestrator tests. Author flagged this gap in PR body with clear cost-benefit reasoning.src/lib/workflow/batch-executor.tssrc/lib/workflow/batch-executor.test.ts(+3 new cases forwithActivityHook)src/commands/run-progress.tsif (event === "activity") return); behavior is "don't break non-TUI renderer" — trivially verified by existing tests not failing.CHANGELOG.mdCoverage: Core behavior (4/4 ACs) fully covered by 9 new tests. Thin wiring layers (phase-executor onActivity throttle + run-progress filter) covered transitively; explicit cost-benefit waiver documented in PR body is reasonable per
feedback_evaluate_gaps_before_fixing.md.Critical paths without tests: None.
Targeted test run: 51/51 passing in
run-state.test.ts+batch-executor.test.ts(3.41s).Full suite (per PR body): 2655/2655 across 103 files.
Code Review
Strengths:
ProgressCallbackvariant — orchestrator updates state; non-TUI renderers filter it out at the boundary (run-progress.ts). No layering violation.ACTIVITY_THROTTLE_MS = 100lives inphase-executor(per-phase scope, not global), matching the 10 Hz TUI poll budget exactly. Errors in the activity callback are swallowed so the run is never disrupted.nowLineWithStaleFallbackis computed at snapshot-read time — no setInterval, no race risk. PreserveslastActivityAtso the "Xs ago" stamp still ticks even in coarse mode.applyProgressEventignores activity events for stale phase names (test "ignores activity events for stale phase names"), correctly handling the race between completion and a final flushed chunk.withActivityHookreturns the input config unchanged whenonProgressis undefined — non-TUI runs pay nothing.Issues: None blocking.
Suggestions (non-blocking):
extractActivityLineonly strips SGR escapes (\x1b\[[0-9;]*m). Cursor-movement / clear-screen sequences would pass through. Almost certainly fine for typical agent output, but a follow-up could broaden the regex if real output proves noisy.Test Quality Review
getSnapshot().issues[0].currentPhase.nowLine), not internals.run-state.test.ts— drives via the publiconProgresscallback.batch-executor.test.tsuses minimalvi.fn()for callback assertion.setTimeoutto ensureDate.now()advances ≥1ms — narrow and necessary. Forced clock manipulation (new Date(Date.now() - 6_000)) used for the stale-fallback test, avoiding real sleep.Anti-Pattern Detection
Dependency Audit
N/A — No
package.jsonchanges.Code Patterns
No new anti-patterns introduced. No
any/as anyadditions in source files. No empty catch blocks for control flow — the twotry { onActivity(text) } catch {}swallows are intentional and documented (activity reporting must never disrupt the run). No N+1, no hardcoded secrets, no SQL.Call-Site Review
New exported functions detected: 1
withActivityHook(config, issue, phase, onProgress)batch-executor.ts:509(spec),batch-executor.ts:761(main phase loop),batch-executor.ts:914(quality-loop)forloopexecutePhaseWithRetryinvocations wrapped consistentlyFindings: All
executePhaseWithRetrycall sites are wrapped. No phase emits agent output without the activity hook attached.CLI Registration Verification
N/A — No
RunOptionschanges. The newonActivity?: (text: string) => voidlives onExecutionConfig(internal config), notRunOptions. No user-facing CLI flag needed.Execution Evidence
N/A — No
scripts/or CLI command changes. This is a library-internal wiring change consumed transitively by the experimental TUI (--experimental-tuialready exists).Skill Command Verification
N/A — No
.claude/skills/**/*.mdfiles changed.Smoke Test
N/A — No workflow-affecting changes (skills, scripts, CLI). The behavior change is internal to the multi-issue TUI rendering path; the existing
--experimental-tuiflag exercises it.CHANGELOG Verification
CHANGELOG.mdexists[Unreleased]entryResult: CHANGELOG requirements met.
Documentation Check
docs/features/experimental-tui-dashboard.mdalready documents the target behavior — the example at line 51 showsnow ⠙ writing src/blog/pagination.tsxfollowed bylast activity 00:02s ago. Before this PR, that example was aspirational (the M1 TUI only rendered the coarserunning <phase>form per the issue body). This PR makes the example accurate without docs changes. No update needed.Self-Evaluation
onOutput→phase-executor100ms throttle →config.onActivity→withActivityHook→ProgressCallback("activity")→RunOrchestrator.applyProgressEvent→state.currentPhase→cloneIssueStatesnapshot withnowLineWithStaleFallback.ProgressCallbacksurface.anytypes, lint clean, branch in sync with main.Verdict: READY_FOR_MERGE
A+ implementation. All four acceptance criteria are literally met, the change is well-scoped (8 files, +290/-17), tests cover the AC space with 9 new cases, CI is fully green, and the PR description honestly documents one design deviation from the issue body (option b implemented over the in-process agent stream instead of tailing nonexistent
.sequant/logs/<issue>-<phase>.logfiles) with sound reasoning.Documentation
Before merging, run
/docs 543to refreshdocs/features/experimental-tui-dashboard.mdif you want to document the new fall-back-to-coarse-after-5s behavior beyond the existing example (optional — current docs are not misleading).Next Steps
/docs 543to add a short note on the 5s stale-fallback inexperimental-tui-dashboard.md.fix(#543): close QA gaps — trailing-edge throttle, broader ANSI strip…
admarble commentedon May 13, 2026
QA Gap-Fix Follow-up
Commit
d051c92(on top ofee994bb) closes the four non-blocking gaps from the prior QA review.What changed
phase-executor.tshad no direct testcreateThrottledReporter(fn, intervalMs)as a pure, exported helper with leading + trailing throttle (was leading-only). Replaces the inline closure.extractActivityLineonly stripped SGR escapes\x1b\[[0-9;]*mto\x1b\[[0-9;?]*[a-zA-Z]— now strips all CSI sequences (cursor moves, line clears, DEC private-mode toggles).run-progress.tsactivity filter had no testsrc/commands/run-progress.test.tswith two tests covering the filter for both the renderer and-qheartbeat branches.Test delta
src/):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.run-state.test.tsasserting non-SGR CSI escapes (\x1b[2K\x1b[G\x1b[?25l…) are stripped.src/commands/run-progress.test.tsfor the activity-event filter.tsc): clean.d051c92(build 20.x / 22.x, typecheck, validate-skills, validate-plugin).Behavior shift
User-visible: the experimental TUI's
nowline will reflect one final activity ping ~100ms after a burst of agent output ends, instead of going stale until the 5s coarse fallback. AC-3 (≤10 Hz poll budget) preserved — the throttle still emits at most 2 fires per 100ms window.Updated verdict
READY_FOR_MERGE — no known gaps remaining. CHANGELOG entry refreshed in the same commit to reflect the new throttle and ANSI behavior.
feat(#543): enrich TUI nowLine with sub-phase activity from agent str…
feat(#543): enrich TUI nowLine with sub-phase activity from agent stream
fix(#543): close QA gaps — trailing-edge throttle, broader ANSI strip…