Skip to content

fix: complete hook guidance and teach asyncRewake - #738

Merged
LeXwDeX merged 4 commits into
mainfrom
fix/hooks-release-integration
Oct 11, 2026
Merged

LeXwDeX merged 4 commits into
mainfrom
fix/hooks-release-integration

Conversation

@LeXwDeX

@LeXwDeX LeXwDeX commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Issue for this PR

Closes #737

Type of change

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

What does this PR do?

Why

OpenCode already supports background asyncRewake hooks, 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.md is already present on main and is not part of this change.

The guidance explains async with asyncRewake, 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 typecheck passed; focused skill/guidance tests passed (10).
  • packages/opencode: bun run typecheck passed; focused skill/command/system/async-rewake tests passed (49).
  • bun run toolchain:check passed; Prettier and git diff --check origin/main...HEAD passed.
  • Before integration, source-worktree live acceptance used local-proxy-compatible/qwen-max in an isolated temporary project via the source bun serve; the installed opencode binary was not replaced. The built-in skill loaded, the model authored .opencode/hooks.json and 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.
  • The first GLM authoring attempt timed out before reaching idle and is not counted as a passing run. The strict 90-second no-signal timeout was not measured.
  • Final head 5a47380a7a452c7347663d10e7e563017cf135db includes 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.
  • On the final integrated source shared with fix(dag): capture final answers and deliver parent reports once #736, isolated Qwen self-authoring acceptance was repeated successfully: one user prompt, zero driver hook registrations, loaded built-in skill, model-authored hook and script, 2.266907 seconds confirmed idle before a fresh nonce resumed the original session, and no repeat during six seconds. Cleanup preserved user configuration and removed temporary credentials and task-owned processes. This was development-source acceptance, not installed-binary acceptance.
  • Typecheck, Unit Tests (linux), E2E Tests (linux), E2E Tests (windows) and CodeQL all passed on this final PR head.

Screenshots / recordings

The generated hook configuration and same-session replies were verified through the isolated request, event, transcript, and cleanup records.

Checklist

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

The merge from current origin/main is an integration commit; the final PR diff contains only the nine files listed by Git.

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
LeXwDeX marked this pull request as ready for review October 10, 2026 21:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T21:46:44.908405Z 5a47380 New commits
🔒 Security Review ✅ Completed 2026-10-10T21:46:36.791415Z 5a47380 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread packages/core/src/plugin/skill/configure-hooks.md Outdated
Comment thread packages/core/src/plugin/skill/configure-hooks.md Outdated
Comment thread packages/core/src/plugin/skill/customize-opencode.md Outdated
Comment thread packages/core/src/plugin/skill/configure-hooks.md Outdated
Comment thread packages/core/src/plugin/skill/configure-hooks.md Outdated
Comment thread packages/core/src/plugin/skill/configure-hooks.md Outdated
Comment thread packages/core/src/plugin/skill/configure-hooks.md Outdated
@LeXwDeX
LeXwDeX merged commit 17a42b5 into main Oct 11, 2026
9 checks passed
@LeXwDeX
LeXwDeX deleted the fix/hooks-release-integration branch October 11, 2026 01:01
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.

fix: audit hook guidance and teach asyncRewake

1 participant