Skip to content

fix(reflection): remove time.completed guard that caused false negatives (#109)#110

Merged
dzianisv merged 1 commit intomainfrom
fix/issue-109-time-completed-false-negative
Feb 15, 2026
Merged

fix(reflection): remove time.completed guard that caused false negatives (#109)#110
dzianisv merged 1 commit intomainfrom
fix/issue-109-time-completed-false-negative

Conversation

@dzianisv
Copy link
Owner

Summary

  • Fixes Session stopped #109: Reflection silently skipped sessions where the agent stopped mid-task (context exhaustion, rate limits, model stopping) because the time.completed guard (Issue Reflection plugin gives feedback when user stops the opencode session by clicking ESC. Critical bug. #82) treated missing time.completed as an ESC abort
  • Removes the time.completed guard from runReflection() — ESC abort detection now relies solely on the recentlyAbortedSessions map (populated by session.error)
  • Adds ABORT_RACE_DELAY (1.5s) in the session.idle handler to handle the race where session.idle fires before session.error when user presses ESC

Changes

File Change
reflection-3.ts Remove time.completed guard, add ABORT_RACE_DELAY constant and post-delay abort re-check
test/reflection.test.ts Add Issue #109 regression tests, update Issue #82 tests to document new behavior
test/abort-race.test.ts Add race delay test, update existing tests for new approach

Testing

  • npm test: 319 passed, 5 skipped
  • npm run eval:judge: 23/23 passed
  • npm run eval:stuck: 12/12 passed
  • npm run eval:compression: 12/12 passed

…ves (#109)

The time.completed check on the last assistant message was intended to catch
ESC aborts (Issue #82), but it also suppressed reflection for sessions where
the model stopped producing output without user intervention (context
exhaustion, rate limits, network timeouts).

- Remove time.completed guard from runReflection()
- Add ABORT_RACE_DELAY (1.5s) in the session.idle handler so session.error
  can arrive first when the user presses ESC
- Re-check recentlyAbortedSessions after the delay
- Add Issue #109 regression tests in reflection.test.ts and abort-race.test.ts

Closes #109
@dzianisv dzianisv merged commit 67f444e into main Feb 15, 2026
2 checks passed
@dzianisv dzianisv deleted the fix/issue-109-time-completed-false-negative branch February 15, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session stopped

1 participant