Skip to content

fix(opencode): finish prompt loop by parent link - #40099

Open
miaojixuezhang wants to merge 1 commit into
anomalyco:devfrom
miaojixuezhang:clock-skew-loop
Open

fix(opencode): finish prompt loop by parent link#40099
miaojixuezhang wants to merge 1 commit into
anomalyco:devfrom
miaojixuezhang:clock-skew-loop

Conversation

@miaojixuezhang

Copy link
Copy Markdown

Issue for this PR

Closes #40098

Type of change

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

What does this PR do?

A finished assistant turn is linked to its user message by parentID. Comparing their IDs assumes the client and server clocks agree; when a client clock is ahead, the prompt loop can run the completed turn again. This uses the parent link instead and adds a regression test with deliberately reversed ID order.

How did you verify your code works?

  • Regression test times out before the fix and passes after it.
  • bun test test/session/prompt.test.ts — 57 pass, 1 skip.
  • bun typecheck from packages/opencode.
  • Prettier check on both changed files.

Screenshots / recordings

Not applicable; this is a prompt-loop fix.

Checklist

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

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

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

Based on my search results, I found one highly relevant related PR:

Potential Related PR:

This PR seems directly related to the current PR #40099, as both fix the prompt loop logic by switching from ID-based comparison to parent-link-based logic. However, since PR #38387 already exists, you may want to verify if:

  1. This is a regression that needs fixing again, or
  2. The fix from fix(session): end the turn loop by reply parent, not message ID order #38387 needs adjustment/expansion

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.

Prompt loop may repeat a completed turn when client clock is ahead

1 participant