fix(abort-handling): extend abort window and use timestamp-based guard to prevent UI idle lock#1846
fix(abort-handling): extend abort window and use timestamp-based guard to prevent UI idle lock#1846iyoda wants to merge 2 commits intocode-yeongyu:devfrom
Conversation
…g across repeated idles - Increase ABORT_WINDOW_MS from 3s to 10s to cover all post-abort idle events - Stop clearing abortDetectedAt on first idle within window so repeated idles remain suppressed until the window expires - Add test for repeated idle suppression within abort window - Use ABORT_WINDOW_MS constant in stale-abort test instead of hardcoded value Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Change SessionState.lastEventWasAbortError (boolean) to abortDetectedAt (number) for time-based abort detection - Use 10s ABORT_WINDOW_MS so repeated session.idle events after MessageAbortedError are suppressed throughout the window - Extract getAbortClearSessionID() to consolidate abort-clear logic for message.updated, message.part.updated, and tool.execute events Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
There was a problem hiding this comment.
No issues found across 5 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: All tests thoroughly cover abort window logic; cubic found no issues and changes are safe with proper handling of abort state.
Related Issues
|
Summary
MessageAbortedErrorfollowed by rapidsession.idleeventstodo-continuation-enforcerandatlashooks had guards that only blocked the first idle after abort, allowing subsequent idles to trigger continuation injection and lock the UIProblem
When
MessageAbortedErrorfires, OpenCode emits multiplesession.idleevents in quick succession (via bothsession.idleand synthetic idle fromsession.status). The existing abort guards had two bugs:abortDetectedAton the first idle within the window, so the 2nd+ idle passed throughlastEventWasAbortErrorflag that reset tofalseafter the first idle checkEvidence from logs
The following log excerpt from
oh-my-opencode.logshows the actual incident at2026-02-14T20:05:15Z:Key observations:
session.idleevents fired from a singleMessageAbortedError— the first 4 arrived within 50ms of each other at20:05:15, and a 5th arrived 38 seconds later at20:05:53todo-continuation-enforcerhappened to skip via API fallback (checking last assistant message), andatlasskipped due to agent mismatch — but neither used the event-basedabortDetectedAtguard, meaning the guard was already consumed or clearedABORT_WINDOW_MS, so even the event-based guard would not have caught idle fix(ast-grep): add validation for incomplete function declaration patterns #5 — but the new 10s window still would not cover it. This is acceptable because by 38 seconds, real user activity should have occurred (and the idle fix(ast-grep): add validation for incomplete function declaration patterns #5 was correctly handled by "All todos complete")Changes
todo-continuation-enforcer(constants.ts, idle-event.ts, test)ABORT_WINDOW_MSfrom 3s → 10s to cover all post-abort idle eventsabortDetectedAtwithin the window — flag now persists until window expires or real activity (user message, assistant response, tool execution) clears itatlas(types.ts, event-handler.ts)lastEventWasAbortError: booleanwithabortDetectedAt: number(timestamp)ABORT_WINDOW_MStime-based guard — repeated idles suppressed throughout windowgetAbortClearSessionID()helper to consolidate abort-clear logic across event typesVerification
bun test src/hooks/todo-continuation-enforcer/todo-continuation-enforcer.test.ts— 43 pass, 0 failbun test src/hooks/atlas/index.test.ts— 36 pass, 0 failbun run typecheck— cleanlsp_diagnostics— no errors on all modified files