Skip to content

fix: delay idle event until turn finishes#132

Merged
graphite-app[bot] merged 1 commit intomainfrom
fix-delay-idle-event-until-turn-finishes-in-openco
Feb 7, 2026
Merged

fix: delay idle event until turn finishes#132
graphite-app[bot] merged 1 commit intomainfrom
fix-delay-idle-event-until-turn-finishes-in-openco

Conversation

@NathanFlurry
Copy link
Member

No description provided.

Copy link
Member Author

NathanFlurry commented Feb 7, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@NathanFlurry NathanFlurry marked this pull request as ready for review February 7, 2026 09:09
@NathanFlurry NathanFlurry changed the base branch from 02-06-fix_route_claude_askuserquestion_answers_via_permission_control_response to main February 7, 2026 09:09
@graphite-app
Copy link

graphite-app bot commented Feb 7, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the fix-delay-idle-event-until-turn-finishes-in-openco branch from 07532e4 to 479c846 Compare February 7, 2026 09:09
@graphite-app graphite-app bot merged commit 479c846 into main Feb 7, 2026
2 of 4 checks passed
@railway-app railway-app bot temporarily deployed to sandbox-agent / production February 7, 2026 09:11 Inactive
@railway-app railway-app bot temporarily deployed to sandbox-agent / preview February 7, 2026 09:11 Inactive
@claude
Copy link

claude bot commented Feb 7, 2026

Code Review

Issue: Idle events may be permanently lost when suppressed

Location: opencode_compat.rs:1827-1832

Problem: When turn.completed or session.idle events arrive while open_tool_calls is non-empty, the code returns early (line 1832), successfully suppressing premature idle event emission. However, when tool calls are subsequently removed from open_tool_calls (at lines 2304 and 2576), there is no mechanism to check whether the set has become empty and emit the previously-suppressed idle event.

Impact: The session.status (idle) and session.idle events will be permanently lost for that turn. The OpenCode client will never receive the idle signal, potentially leaving the UI stuck in a "busy" or "thinking" state indefinitely until the session ends.

Root cause: The PR implements the "defer" mechanism (suppress when tool calls are open) but is missing the "resume" mechanism (emit when tool calls drain).

Suggested fix: Track whether an idle event was deferred, then emit it when open_tool_calls becomes empty:

  1. Add a deferred_idle: bool field to OpenCodeSessionRuntime
  2. At line 1831, instead of returning early, set runtime.deferred_idle = true
  3. At lines 2304 and 2576 after removing from open_tool_calls, check:
    if runtime.open_tool_calls.is_empty() && runtime.deferred_idle {
        runtime.deferred_idle = false;
        // emit the session.status (idle) and session.idle events here
    }

This ensures the idle event is delayed until tool calls complete, but not lost entirely.

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.

1 participant