Skip to content

fix(session): dedupe idle status events - #40984

Closed
zcxGGmu wants to merge 1 commit into
anomalyco:devfrom
zcxGGmu:attention-idle-dedupe
Closed

zcxGGmu wants to merge 1 commit into
anomalyco:devfrom
zcxGGmu:attention-idle-dedupe

Conversation

@zcxGGmu

@zcxGGmu zcxGGmu commented Aug 7, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #40882

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

SessionStatus.set(idle) now only publishes session.status / session.idle when the session was previously in a non-idle state. Repeated idle writes are no-ops, so clients do not receive duplicate idle/done events while a session is already idle.

The regression test covers a busy -> idle -> idle sequence and asserts that only one idle transition is published.

How did you verify your code works?

  • cd packages/opencode && bun test test/session/status.test.ts --timeout 30000
  • cd packages/opencode && bun test test/session/retry.test.ts --timeout 60000
  • cd packages/opencode && bun test test/session/processor-effect.test.ts --test-name-pattern 'status|idle|busy' --timeout 90000
  • cd packages/opencode && bun run typecheck
  • cd packages/tui && bun test test/cli/cmd/tui/notifications.test.ts --timeout 60000
  • bunx oxlint packages/opencode/src/session/status.ts packages/opencode/test/session/status.test.ts
  • git diff --check

Screenshots / recordings

N/A; this is an event emission fix.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

renekris added a commit to renekris/opencode-lowmem that referenced this pull request Aug 23, 2026
…0984)

Repeated idle writes republished Status and Idle events to every
connected client. SessionStatus.set now publishes only when
transitioning from a non-idle state; repeated idle writes are no-ops.

README: ported-table row, deferred-ports section for anomalyco#43769/anomalyco#40698
(tree shapes absent at v1.18.21), enriched deleted-session-cleanup row.

Co-authored-by: zcxGGmu <zcxGGmu@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI attention sound plays repeatedly while idle with no events (WSL2)

2 participants