Skip to content

fix(cli): start an OpenCode session's hooks with its id and prove several plugins answer one Stop - #1356

Closed
blafourcade wants to merge 2 commits into
nextfrom
fix/bridge-turn-end-answer-in-run-mode
Closed

blafourcade wants to merge 2 commits into
nextfrom
fix/bridge-turn-end-answer-in-run-mode

Conversation

@blafourcade

Copy link
Copy Markdown
Contributor

🎯 What & why

OpenCode's session hooks started with no session id, at plugin load, and again each time the host recreated the plugin. A Stop from two plugins on one turn was not shown to reach the model in run mode. This starts the hooks on a session's first event naming it, and proves that several plugins answering one Stop each reach the model.

Refs #1320

🛠️ How it works

  • SessionStart runs once, on the first event that names a session, with the id and folder that event carries. A new session's first event names its folder under info; a continued session names none.
  • The OpenCode profile declares session.created for it, as Kilo's does. The orphaned server-init payloads are removed.
  • Test: a captured first event of a continued session drives it. A second test holds that two plugins answering the same Stop each reach the model.
  • V2 adapter: its created event names no session, so under V2 SessionStart runs at the first turn's idle terminal. Stated as a limit in the OpenCode bridge module doc, not coded as a workaround.
  • Kilo bridge comment: the run-mode Stop loss is stated as a limit with versions, citing hooks-host-map.md.

🧪 How to verify

cd cli && pnpm exec vitest run tests/contexts/tools/hooks-routes.integration.test.ts

Goldens moved, all because the generated bridge text changed (comment, doc and V2 line): the five Kilo and five OpenCode cli/tests/fixtures/hooks-routes fixtures, framework-build/golden.json, translate-install/golden.json.

Gates on the final commit, all exit 0: make validate; pre-commit (first run red, rerun green, the first failure was a scripts-tests run that reported changed (content): commit-msg under the shared .git/hooks, not root-caused); pre-push (9907 passed, 1 expected fail, 15 skipped); build, 879.8 KB of 897 KB budget (+0.6 KB).

⚠️ Heads-up

  • Kilo kilo run does not land a Stop follow-up from session.drained on 7.8.27 (probed, negative). The host map's 3/3 measurement is not reproduced. The first expected Kilo behaviour is unmet and open on 7.7.5 and 7.8.27. Hence Refs, not Closes.
  • Interactive Kilo is not probeable headless (BLOCKED-PROBE).
  • V2 SessionStart timing is a limit, not verified against a captured V2 payload.
  • The pre-commit first-run failure above is unexplained.

🔗 Linked issue

Refs #1320

✅ I certify

  • I DO CERTIFY I READ EACH LINE OF THE PULL REQUEST BECAUSE I AM A SOFTWARE ENGINEER, NOT A AI PUPPY.

🤖 Generated with Claude Code

blafourcade and others added 2 commits November 25, 2026 15:13
…eral plugins answer one Stop

SessionStart ran once at plugin load with no session id, and again each time the host recreated the plugin. It now runs on the first event naming a session, once, with the id and folder the event carries. The OpenCode profile declares session.created for it, as Kilo's does, and the orphaned server-init payloads are removed.

A captured first event of a continued session drives its test. A test holds that two plugins answering the same Stop each reach the model. The Kilo bridge comment states the open run-mode loss as a limit with its versions. The V2 adapter's created event names no session, stated as a limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s from the Kilo template

The session-start call mapping lived once per host template. It is now one
generated part both read, so only what differs per host stays in the host.
The Kilo template states its run-mode limit with the probed versions and
keys, and its provenance moves to the generator's doc comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@blafourcade

Copy link
Copy Markdown
Contributor Author

Superseded by #1378, which consolidates the five OpenCode and Kilo bridge branches into one shared runtime (V1 and V2) and is merged on next.

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.

1 participant