Skip to content

feat(opencode): add LLM stream stall detection and check_task visibility (#398)#403

Merged
randomm merged 2 commits intodevfrom
feature/issue-398-stall-detection
Apr 8, 2026
Merged

feat(opencode): add LLM stream stall detection and check_task visibility (#398)#403
randomm merged 2 commits intodevfrom
feature/issue-398-stall-detection

Conversation

@randomm
Copy link
Copy Markdown
Owner

@randomm randomm commented Apr 8, 2026

Summary

Implements EPIC #398 — Subagent LLM stall detection and visibility.

#399 — LLM Stream Stall Detector:

  • Tracks lastTokenTime in processor.ts stream loop, updated on every token-generating event
  • Detects stalls when no tokens received for configurable timeout (default 3 minutes, OPENCODE_STALL_TIMEOUT_MS)
  • Validates env var for NaN and non-positive values before entering stream loop
  • Exports stalledSessions Set for cross-module stall tracking with proper cleanup on all return paths
  • Logs warn-level message with session ID and elapsed time on stall detection

#400 — Enhanced check_task Visibility:

  • Extends TaskResult with stallDetected, lastToolCalls, lastActivity for running tasks
  • Shows last 3 tool calls with name, status, and ISO timestamp
  • lastActivity reflects the most recent tool call timestamp
  • stallDetected uses SessionProcessor.stalledSessions.has(id) for reliable detection
  • Completed/failed tasks omit visibility fields for backward compatibility

Manifest Update:

  • Updated async-tasks feature with processor.ts in modifiedFiles
  • Added lastTokenTime, OPENCODE_STALL_TIMEOUT_MS, LLM stream stalled, stalledSessions to criticalCode
  • Added stall.*detector, stream.*stall, lastTokenTime, export const stalledSessions to absorptionSignals
  • Added processor-stall.test.ts to tests

Fixes #398
Fixes #399
Fixes #400

randomm added 2 commits April 8, 2026 14:31
…ity (#398)

- Add lastTokenTime tracking in processor.ts stream loop
- Detect stalls when no tokens received for configurable timeout (default 3min, OPENCODE_STALL_TIMEOUT_MS)
- Export stalledSessions Set for cross-module stall tracking
- Extend TaskResult with stallDetected, lastToolCalls, lastActivity for running tasks
- Show last 3 tool calls with name, status, and timestamp in check_task
- Validate OPENCODE_STALL_TIMEOUT_MS for NaN and non-positive values
- Update async-tasks fork-feature manifest with stall detection markers

Fixes #398, Fixes #399, Fixes #400
…act getStallTimeout (#398)

- Make stalledSessions private with isSessionStalled/markSessionStalled/clearSessionStalled accessors
- Replace raw Set export with encapsulated functions for proper module boundary
- Add hasStartTime type guard replacing unsafe cast in check_task.ts
- Extract getStallTimeout() function from inline env var parsing
- Add getStallTimeout to fork-features manifest criticalCode
- Strengthen type guard to validate time.start is number
@randomm randomm merged commit aa39435 into dev Apr 8, 2026
1 check passed
@randomm randomm deleted the feature/issue-398-stall-detection branch April 8, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant