Skip to content

fix(core): keep snapshot readiness interruptible before publication - #55402

Closed
CasualDeveloper wants to merge 1 commit into
anomalyco:devfrom
CasualDeveloper:snapshot-stop
Closed

CasualDeveloper wants to merge 1 commit into
anomalyco:devfrom
CasualDeveloper:snapshot-stop

Conversation

@CasualDeveloper

@CasualDeveloper CasualDeveloper commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Fixes #55401
Split out of #55315.

Type of change

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

What does this PR do?

I keep the pending start-snapshot wait interruptible when a provider fails before producing an event. Stop can settle without waiting for capture to finish, before any assistant/step publication. Final publication and tool cleanup remain uninterruptible.

Two production lines; no admission, API, plugin, or UI changes. The fix preserves upstream's newer retry and cooperative-stop handling.

How did you verify your code works?

  • Independently rebased this PR onto dev at 0354362b857beae78166d4305f06c0b2f47c251e.
  • 281 runner/tool-event cases pass, including idle and no-late-write checks before releasing capture; official Core TypeScript checking passes.
  • Both held-capture regressions fail with BASE's step implementation and pass with the two-line fix restored. The tests stay focused on interruption; the extra revert-stage assertions requested out of this PR remain removed.
  • Root bun run check passes. These checks ran on this focused branch, without the other feature branches.
  • Reviewed the original-to-refreshed range-diff; one commit, two files, original authorship retained. No generated API changes.

Screenshots / recordings

No visual changes.

Checklist

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

Process: human-directed, with agentic assistance from openai/gpt-6-astra.


Added by the opencode bot (AI-generated).

Related: #48657

@github-actions

Copy link
Copy Markdown
Contributor

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

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks correct. On the base I reproduced the hang from #55401 with the bot's held-capture script, for both a retryable and a terminal pre-output failure. With these two lines applied, both cases settle while the capture is still held. The new tests fail on base production code and pass with the change. The runner test suite and the core typecheck pass.

If Stop arrives during the new restore(Fiber.join(pendingStartSnapshot)), nothing has been published yet, so no assistant or step records are left behind, and the scoped capture fiber is cleaned up. A failed capture is handled as before, because the later step publication already joins the same fiber.

Public API: unchanged.

One small suggestion on the tests (inline): the revert-stage part checks more than this fix needs and could be trimmed.

Related: #48657

@CasualDeveloper

Copy link
Copy Markdown
Contributor Author

I rebased this onto dev at 22e771f589 and removed the revert-stage addendum requested in review. Both focused regressions still fail without the two-line fix and pass with it. All 258 runner/tool-event cases and the root lint/typecheck gate pass.

Restore interruption while raw pre-output provider failure waits for the pending start snapshot, before retry or failure publication. Preserve uninterruptible final publication and tool cleanup.

Cover retryable and terminal failures with a held capture, interruption-only idle, subsequent revert staging, and no late step or tool writes.
@github-actions

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.

@CasualDeveloper

Copy link
Copy Markdown
Contributor Author

Please reopen this PR. It was closed by the November 14 age/reaction cleanup, and I’m still maintaining this two-line fix for #55401. The earlier automated review reproduced both held-capture hangs and confirmed the fix; I removed the extra revert-stage assertions from this focused PR as requested.

On November 16 I refreshed the maintained copy onto dev at 0354362b85. The snapshot-readiness checkpoint retains the cancellable wait alongside upstream’s newer retry and cooperative-stop handling. The combined source passed 473 Core tests, including retryable and terminal pre-output failures with a held capture, official Core typechecking, and the root checks.

Those fresh results are from the maintained combined source, whose tests include broader revert coverage. This PR still points at 14d89c77aa and needs its own refresh before merge; its scope remains the two-line readiness fix and focused interruption tests.

@CasualDeveloper

Copy link
Copy Markdown
Contributor Author

I’ve now refreshed this PR’s own branch onto dev at 0354362b85: b5f2e24933. It remains the two-line production fix with focused interruption tests. All 281 runner/tool-event cases, official Core typechecking and the root checks pass independently. Both held-capture regressions fail without the fix and pass with it. The requested removal of the revert-stage addendum is preserved. I updated the description; please consider reopening it for review.

The fork branch is verified at the linked commit. GitHub's closed PR record still reports the older head SHA, so the link above identifies the refreshed revision.

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.

core: Stop waits for a pending snapshot after pre-output provider failure

1 participant