Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the OpenCode agent plugin so turn-start runs synchronously (blocking) to ensure session initialization completes before subsequent agent actions (and to avoid shutdown races), and adds a regression test to enforce the behavior.
Changes:
- Switch
turn-startdispatch from asynccallHookto blockingcallHookSync. - Update plugin inline documentation to reflect the expanded sync-hook use case.
- Add a unit test verifying
turn-startis dispatched viacallHookSync.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/entire/cli/agent/opencode/hooks_test.go | Adds a regression test asserting turn-start uses the sync hook path. |
| cmd/entire/cli/agent/opencode/entire_plugin.ts | Changes turn-start hook dispatch to callHookSync and updates comments. |
Collaborator
Author
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 5472a59. Configure here.
Entire-Checkpoint: 07fb7365eb59
Entire-Checkpoint: 0786501cea6f
Entire-Checkpoint: 9605eabc462d
Entire-Checkpoint: fc2bd7de6ad8
ef7dbe7 to
4dad9f6
Compare
Entire-Checkpoint: c70a9ea6d74f
4dad9f6 to
23e74ce
Compare
gtrrz-victor
approved these changes
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
turn-startsynchronous (callHookSync) so session state is initialized before fast mid-turn commits hit git hooksmessage.updatedforopencode runflows wheremessage.part.updatedfires too lateopencode.json,.opencode/) from session tracking via newProtectedFilesProvideroptional interfaceAlso handles #883
Test plan
message.updatedfallback (session-start and turn-start)DetectFileChangesandFilterAndNormalizePathsAllProtectedFiles()registry functionmise run checkpassesNote
Medium Risk
Adjusts OpenCode hook dispatch timing and lifecycle prompt backfill, which can change when sessions/turns are recorded and what files/prompts are attributed to a checkpoint.
Overview
Makes OpenCode hook execution more reliable in fast/non-interactive flows by switching
turn-startto synchronous dispatch, adding amessage.updatedfallback to emitsession-start/turn-startearly, and centralizing per-session state resets viaresetSessionTracking.Extends the OpenCode agent with
PromptExtractorsupport and updates lifecycle turn-end handling to backfill missing prompt metadata from OpenCode export transcripts (and update session state accordingly).Improves session file-change attribution by filtering out agent-owned paths (e.g.
.opencode/...andopencode.json) from change detection/normalization, with new tests covering the updated behaviors.Reviewed by Cursor Bugbot for commit 5472a59. Configure here.