Skip to content

fix(app): abort session on synthetic continue loop detection#793

Closed
ZeusCraft10 wants to merge 1 commit intodifferent-ai:devfrom
ZeusCraft10:fix/777-synthetic-continue-loop
Closed

fix(app): abort session on synthetic continue loop detection#793
ZeusCraft10 wants to merge 1 commit intodifferent-ai:devfrom
ZeusCraft10:fix/777-synthetic-continue-loop

Conversation

@ZeusCraft10
Copy link

@ZeusCraft10 ZeusCraft10 commented Mar 7, 2026

Summary

  • When the synthetic continue loop is detected, actually abort the session instead of just logging a warning.

Why

  • Users are seeing infinite work summaries after a command finishes. The LLM ends its response with "Suggested next steps for continuation," and OpenCode interprets that as wanting to continue, sends a synthetic continue prompt, gets another summary, and it just keeps going. The detection for this was already in place but it only logged a warning and never stopped the loop.

Issue

Scope

  • session.ts: added abortSession callback to store options, call it when loop threshold (3+ synthetic continues in 60s) is hit, track per-session to only abort once
  • app.tsx: wire the existing abort function into the session store

Out of scope

  • Auto-compaction cooldown (defaults to off, not related to this bug)
  • Server-side changes to how synthetic continues are generated

Testing

Ran

  • pnpm typecheck
  • node packages/app/scripts/health.mjs
  • node packages/app/scripts/sessions.mjs

Result

  • pass: all three
  • if fail, exact files/errors: N/A

Bug verification

  • Wrote a local reproduction test that simulates rapid synthetic continue events hitting the detection logic
  • Confirmed the old code detects the loop but never aborts (bug reproduced)
  • Confirmed the new code detects the loop and aborts the session exactly once (fix verified)
  • Also verified edge cases: independent sessions get independent aborts, below-threshold events don't false-positive, missing callback doesn't crash

CI status

  • pass: awaiting CI
  • code-related failures: N/A
  • external/env/auth blockers: N/A

Manual verification

  1. Trigger a session where the LLM produces a work summary ending with "Suggested next steps for continuation"
  2. Observe that the session aborts after 3 synthetic continues within 60 seconds instead of looping forever
  3. Start a new session and confirm it works normally (abort tracking is per-session)

Evidence

  • N/A (no UI changes, behavior-only fix)

Risk

  • Low. The abort callback is optional and only fires once per session. Worst case a session that would have looped gets stopped early, which is what we want.

Rollback

  • Revert the commit. The old behavior (warn-only) is restored.

@vercel
Copy link

vercel bot commented Mar 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-software Ready Ready Preview, Comment Mar 7, 2026 11:45pm

@vercel
Copy link

vercel bot commented Mar 7, 2026

@ZeusCraft10 is attempting to deploy a commit to the 0 Finance Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

The following comment was made by an LLM, it may be inaccurate:

@ZeusCraft10
Copy link
Author

Please note. this solution was suggested by claude code. I myself independently reproduced the issue, and verified that this fixes the problem, and looked at the code myself, to verify the fix is correct. I am open to any changes requested.

…nt-ai#777)

When the LLM outputs "Suggested next steps for continuation" at the end
of a work summary, OpenCode sends a synthetic "continue" prompt which
triggers another summary, creating an infinite loop. The existing
diagnostic code detected this (3+ synthetic continues in 60s) but only
logged a warning.

Now calls session.abort() on first loop detection to break the cycle.
Uses a per-session Set to ensure abort fires only once per session.
@ZeusCraft10 ZeusCraft10 force-pushed the fix/777-synthetic-continue-loop branch from f9d5a01 to d85ec41 Compare March 7, 2026 23:44
@ZeusCraft10 ZeusCraft10 marked this pull request as ready for review March 7, 2026 23:47
@ZeusCraft10 ZeusCraft10 closed this Mar 8, 2026
@ZeusCraft10 ZeusCraft10 deleted the fix/777-synthetic-continue-loop branch March 8, 2026 03:53
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.

[Bug]: OpenWork continues infinitely outputting work summaries after command execution

1 participant