Skip to content

fix(tasks): address v2 review follow-ups - #1338

Merged
griffinwork40 merged 1 commit into
mainfrom
fix/tasks-v2-followups
Aug 28, 2026
Merged

fix(tasks): address v2 review follow-ups#1338
griffinwork40 merged 1 commit into
mainfrom
fix/tasks-v2-followups

Conversation

@griffinwork40

Copy link
Copy Markdown
Owner

Summary

Addresses all five follow-up issues from PR #1313 review.

Closes #1331, #1332, #1333, #1334, #1335.

Changes

#1331 — Stale soft-stop handler after disk-path view exit (medium bug)

src/cli/commands/interactive/task-view-mode.ts

Added entry.ctx.setSoftStopHandler?.(null) before the early return in the disk-only path of enterTaskViewMode. Previously wireEscapeToExit installed a closure that was never cleaned up — the disk path returns immediately without entering a tail loop, leaving a stale handler wired to the surface.

#1332 — viewingTaskId tracking inoperative (medium bug)

src/cli/slash/commands/tasks.ts, src/cli/commands/interactive/bootstrap.ts

Added a setTasksIctx(ictx: InteractiveCtx) export and ictxRef module-level variable to tasks.ts. Called from bootstrap.ts after ctx is constructed. Threaded ictx: ictxRef into both TaskViewEntry constructions (list→Enter path and direct /tasks:view path) so viewingTaskId is correctly set and cleared during task view mode.

#1333 — Add live tail tests (low)

src/cli/commands/interactive/task-view.test.ts

Added three test cases under enterTaskViewMode — live tail:

  1. Natural stream completion → exitTaskViewMode called, FOOTER_COMPLETE emitted, viewingTaskId cleared
  2. Esc/abort fires → abort handler invoked, viewingTaskId cleared via wireEscapeToExit path
  3. setSoftStopHandler override is wired correctly — final call passes null to clear handler on natural completion

#1334 — Silent .catch() swallows errors (nit bug)

src/cli/slash/commands/tasks.ts

Changed .catch(() => resolve()) to .catch((e) => { ctx.out.error?.(\task view error: ${String(e)}`); resolve(); })so errors are surfaced via theOutputSink.error` channel instead of being silently discarded.

#1335 — renderEventsView is dead code (low)

src/cli/commands/interactive/task-view.ts

Removed the renderEventsView export (confirmed zero callers with grep). Also removed the now-unused TaskViewOptions interface, DEFAULT_MAX_EVENTS constant, and formatOutputEvent/OutputEvent imports that existed solely to support it. Updated module doc comment accordingly.

Test Results

✓ src/cli/slash/commands/tasks.test.ts (13 tests) 11ms
✓ src/cli/commands/interactive/task-view.test.ts (20 tests) 14ms

Test Files  2 passed (2)
     Tests  33 passed (33)

pnpm lint passes (tsc --noEmit clean). All touched files are within the 350 code-line ceiling.

…1335)

#1331 — Stale soft-stop handler after disk-path view exit
Clear `setSoftStopHandler` to null before returning in the disk-only
path of `enterTaskViewMode`. Previously `wireEscapeToExit` installed a
handler that was never cleaned up when the function returned immediately
(no tail loop), leaving a stale closure wired to the surface.

#1332 — viewingTaskId tracking inoperative
Add `ictxRef` module-level ref and `setTasksIctx(ictx)` export in
tasks.ts. Call it from bootstrap.ts after `ctx` is constructed. Thread
`ictx: ictxRef` into both `TaskViewEntry` constructions (list→Enter
path and direct `/tasks:view` path) so `viewingTaskId` is now set and
cleared correctly during task view mode.

#1333 — Add live tail tests
Add three new test cases in task-view.test.ts under
"enterTaskViewMode — live tail":
  1. Natural stream completion → exitTaskViewMode called, FOOTER_COMPLETE
     emitted, viewingTaskId cleared.
  2. Esc/abort fires → abort handler invoked, viewingTaskId cleared via
     wireEscapeToExit path.
  3. setSoftStopHandler override wired correctly — final call passes null
     to clear the handler on natural completion.

#1334 — Silent .catch() swallows errors
Change `.catch(() => resolve())` → `.catch((e) => { ctx.out.error?.(…); resolve(); })`
so task view errors are surfaced via the OutputSink error channel instead
of silently discarded.

#1335 — renderEventsView is dead code
Remove the `renderEventsView` export from task-view.ts (zero callers
confirmed by grep). Also remove the now-unused `TaskViewOptions`
interface, `DEFAULT_MAX_EVENTS` constant, and `formatOutputEvent` /
`OutputEvent` imports that existed solely to support it.

Fixes #1331, #1332, #1333, #1334, #1335.
@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-afk-docs Ready Ready Preview Aug 28, 2026 12:28am

@griffinwork40
griffinwork40 merged commit d1119a4 into main Aug 28, 2026
11 of 17 checks passed
@griffinwork40
griffinwork40 deleted the fix/tasks-v2-followups branch August 28, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tasks: stale soft-stop handler after disk-path view exit

1 participant