fix(opencode): spawn hooks via node:child_process for Desktop - #2018
Merged
Soph merged 3 commits intoAug 20, 2026
Merged
Conversation
OpenCode Desktop runs the server on Node inside Electron, so Bun.spawn and Bun.spawnSync threw ReferenceError and every hook was swallowed. Use node:child_process spawn/spawnSync so CLI (Bun) and Desktop (Node) both fire hooks. Adds a Node canary that loads the plugin and asserts turn-end actually spawns. Fixes entireio#2014 Co-authored-by: Cursor <cursoragent@cursor.com>
Also fire session.created so the canary exercises spawn (session-start) as well as spawnSync (turn-end). Drop the Go pathToFileURL helper and use Node's instead. Co-authored-by: Cursor <cursoragent@cursor.com> Entire-Checkpoint: 01M08KHX9P54WJ76X843W433DP
Contributor
Author
Soph
approved these changes
Aug 20, 2026
timothybrush
pushed a commit
to timothybrush/cli-2
that referenced
this pull request
Aug 21, 2026
… task data E2E Tests has failed on every push to main since ed9c31c (entireio#2032, "capture background subagent work durably"). One job, factoryai-droid, two tests, both at "expected task checkpoint within 30s" — and failing again on gotestsum's re-run, so deterministic rather than agent nondeterminism. Bisects cleanly: ed34d4d (entireio#2018) was green and is ed9c31c's only parent. It is not a bug in entireio#2032. waitForTaskCheckpoint polled the *shadow branches* for a tasks/ path, which is precisely what entireio#2032 stopped writing: a Worker's turn now lands as a completed session.TaskRecord on the parent, and the transcript is materialized into the parent's checkpoint under tasks/<id>/ at condensation time. entireio#2032 updated its own integration test to the inverse assertion ("a Worker's turn must write a task record, not shadow data") and said so in CLAUDE.md ("records never live on the shadow branch"); these two E2E tests were the only holdout, and they could not object during review because E2E Tests runs on push-to-main, never on a PR. So move them onto the shipped contract, in both directions: - waitForCompletedTaskRecord polls .git/entire-sessions/*.json for a record with a non-empty completed_at (omitempty drops the zero value, so presence is the completion signal). Same strength as the existence check it replaces. - assertNoShadowTaskData pins the inverse — no shadow branch carries a tasks/ path. Narrowed to task data on purpose: a parent session legitimately has shadow branches of its own, since shadow pinning keys on StepCount and says nothing about task content. TestFactoryTaskCheckpointExistsBeforeCommit becomes TestFactoryTaskRecordExistsBeforeCommit — there is no pre-commit checkpoint under the new model, but the durability intent the name carries is still tested: the Worker's work is captured before the user commits. Prompts are untouched, so Vogon's regexes are unaffected; both tests skip on non-Factory agents, so the canary is too. Whether dropping the pre-commit shadow copy weakens durability is entireio#2058's question, not this test's. These assert what shipped; they do not settle it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Entire-Checkpoint: 01M0J4CJ6CCGRXYYVWBSB8Q9H1
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
Bun.spawn/Bun.spawnSyncin the OpenCode plugin withnode:child_processspawn/spawnSyncso hooks fire under both Bun (CLI/TUI) and Node (OpenCode Desktop Electron sidecar)..opencode/plugins/entire.tsin sync and update the agent guide.session-startand syncturn-endactually spawn.Fixes #2014
Test plan
go test ./cmd/entire/cli/agent/opencode/ -run TestPlugin_SpawnsHooksUnderNode -v -count=1go test ./cmd/entire/cli/agent/opencode/ -count=1mise run lint