Repository navigation
fix: complete hook guidance and teach asyncRewake - #738
Merged
Merged
Conversation
Audit the built-in hook skills, command prompts and session guidance against the runtime. Explain supported events, handlers, protocols and lifecycle limits, and teach background polling that resumes an idle conversation. Validate independent hook creation from a natural-language request with an isolated Qwen session, including idle-to-rewake continuation and cleanup. Both affected package typechecks and 59 focused tests passed. Refs #737
LeXwDeX
marked this pull request as ready for review
October 10, 2026 21:08
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 858676b35a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
7 tasks done
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.
Issue for this PR
Closes #737
Type of change
What does this PR do?
Why
OpenCode already supports background
asyncRewakehooks, but its embedded hook guidance did not explain how to configure them or how a completed hook resumes an idle session. A natural-language request could therefore result in a normal hook that never resumes the conversation.Scope
Audit current hook guidance against runtime behavior and update the built-in configure-hooks skill, related hook prompts, and directly affected regression expectation. Preserve runtime behavior, existing configuration, and authorization boundaries.
What changed
The change audits the current hook guidance against runtime behavior, updates the embedded configure-hooks skill and related hook prompts, documents the async completion protocol and lifecycle limits, and adjusts prompt and event-coverage expectations. The final PR diff contains nine files;
AGENTS.mdis already present on main and is not part of this change.The guidance explains
asyncwithasyncRewake, completion output, timeouts, one-shot and anti-loop behavior, and the requirement that the host remain alive. The creation prompt routes polling requests to that reference while retaining existing merge/append behavior.Approach
Keep runtime behavior unchanged. Update model-facing guidance and the directly affected prompt/test, then validate that a model can author the polling hook from a natural-language request and that a later signal resumes the same idle session.
Acceptance
The hook reference and prompt describe supported behavior accurately, and the focused guidance, command, system-prompt, and async-rewake checks pass. An isolated Qwen session independently authored its files and resumed after a fresh marker.
How did you verify your code works?
Evidence
On the integrated branch, using the repository-pinned Node 24.21.0:
packages/core:bun run typecheckpassed; focused skill/guidance tests passed (10).packages/opencode:bun run typecheckpassed; focused skill/command/system/async-rewake tests passed (49).bun run toolchain:checkpassed; Prettier andgit diff --check origin/main...HEADpassed.local-proxy-compatible/qwen-maxin an isolated temporary project via the sourcebun serve; the installedopencodebinary was not replaced. The built-in skill loaded, the model authored.opencode/hooks.jsonand its polling script without hook field names or code in the request, and the driver registered no hook on the model's behalf. After 2.28 seconds observably idle, a fresh marker caused a completed reply containing that marker in the same session. No repeated reply appeared during the following 6 seconds. Cleanup confirmed no remaining task-owned process and no user configuration changes.5a47380a7a452c7347663d10e7e563017cf135dbincludes all seven review corrections and the event-coverage assertion repair. Core focused tests passed 12 cases; opencode hook and related regressions passed 360 cases. Both package typechecks passed. All seven review threads have been answered and resolved, and the final combined source review passed.Screenshots / recordings
The generated hook configuration and same-session replies were verified through the isolated request, event, transcript, and cleanup records.
Checklist
The merge from current
origin/mainis an integration commit; the final PR diff contains only the nine files listed by Git.