Repository navigation
테스트 stand-in을 빌드마다 한 번만 시작해 부하에서 첫 실행 대기가 제품 기한을 먹지 않는다 - #815
Merged
Merged
Conversation
macOS checks a file the first time it starts, once per file, and the checks of every process on the machine wait in one line. The hook tests copied the helper and wrote their stand-in `hide` afresh per test, and the kit tests wrote `launchctl`, `codex`, `herdr` and login-shell stand-ins per fixture, so under load the first start queued inside the hook budget or the kit's 5 s deadlines (issue 813). Each stand-in is now one read-only file per body in the build folder, started once per process under a hang guard before a test is given it, and a test's folder holds a hard link to it; the helper is linked from the file cargo built. The four `warm_first_exec` copies and `version_program` are gone.
The `codex_daemon` unit tests wrote their stand-in `codex` afresh per test and ran it under its 5 s deadline, the same queue as issue 813; under nextest at load 31 two of them failed. The store now lives in hide-agent-hooks/src/stand_ins.rs, built only into tests: this crate's unit and integration tests and hide-kit's unit tests include the one file. It keeps one read-only file per body beside the build's test binaries and puts a hard link, or a copy started once across filesystems, where a test needs the program. docs/TESTING.md states the rule.
… test hide-platform's `fixture_inspection_failure_does_not_attempt_a_bootout` wrote its `launchctl` stand-in afresh and ran it under the login agent's 5 s deadline, the same queue as issue 813, and failed under load with no `calls` file. The store's one file now lives in hide-platform/tests/it/stand_ins.rs, the bottom crate, so a change to it plans the lanes of every crate that includes it; hide-agent-hooks and hide-kit include it by `#[path]`.
yansfil
force-pushed
the
fix/first-exec-warmup
branch
from
October 8, 2026 18:48
a4b2788 to
aa5aee4
Compare
This was referenced Oct 8, 2026
yansfil
added a commit
that referenced
this pull request
Oct 8, 2026
Related: #769 (adapter declarations this builds on), #810 (no agent row draws an in-process subagent count yet) ## Summary OpenCode has no command hook, so inside Hide it got none of Hide's collaboration: no letters on its prompt, no spawn guard, no Memory, no subagent count. This adds a Hide-owned OpenCode plugin, `~/.config/opencode/plugins/hide.js` beside Herdr's, written and removed only by `hide-agent-hooks` and installed as OpenCode's hook piece in the kit. Inside a Hide-managed Herdr pane it adds guidance, Project Memory and waiting letters to a root session's prompt as one synthetic part, and confirms the letters only after OpenCode reports that part stored. It also refuses `herdr agent start` with the spawn guard's reason, refuses `question` in a Factory worker pane, and reports subagent counts from child-session events. OpenCode stays unbelled, since its resume picker reads `done`. Outside a managed pane the plugin registers nothing. Settings now name OpenCode's piece `Plugin`, drop its `Basic` chip, and say on any agent's row why its hook could not be put in (for example, the agent's config folder does not exist yet). ## Review - **판단해 주세요**: the agent row now shows one quiet line when a hook is Absent with a reason, for every agent (B14). On Windows, Cursor's row says its hook is not written there. - **판단해 주세요**: the subagent count reaches Herdr's pane tokens and the snapshot (`children.subagents`), as Claude Code's does. No row draws it yet for any agent: #810. - **조심해서 볼 파일**: `hide-agent-hooks/src/opencode/plugin.js` - runs inside the operator's OpenCode. Every hook has a budget and fails open except the refusal. - **조심해서 볼 파일**: `herdr-core/src/delivery/mailbox.rs` - an unbelled kind with a prompt hook now takes letter bodies on any prompt. The plugin confirms later. - **조심해서 볼 파일**: `herdr-core/src/runtime/memory.rs` - receipts from OpenCode's label read are recorded on one owned thread off the lock, with queues capped at 64 and 256. - **조심해서 볼 파일**: `.github/workflows/pr.yml`, `herdr-update.yml` - the rust lane installs Node 22, because `hide-agent-hooks` runs the plugin under Node in its tests. - **비용 검토**: - Per OpenCode prompt: one helper process, plus one count report after it. - Per child status change: at most one running report, with only the newest waiting. - Session bookkeeping is capped at 512, evicting finished children first. - Nothing is added on hided's high-frequency paths. The lineage pass reads one kit status instead of cloning the kit. ## Evidence - **확인한 것**: sealed suite `verify-cargo.sh test` and `lint` PASS on the final head, merged with main at #821. - **확인한 것**: Node plugin test, run with OpenCode 1.18.30's hook and event shapes: - root and child prompts; - deferred confirm and an unstored prompt; - budgets, plus slow, failing and garbled helpers; - spawn and question refusal, including a subagent's question; - background child counts; - more than 512 sessions. - **확인한 것**: `web/e2e/opencode-plugin.spec.ts` on a private pinned Herdr 0.9.3, where the kit writes the plugin and a stand-in OpenCode in two panes loads it: - a letter rides the next prompt and is confirmed only once stored; - `herdr agent start` is refused; - Herdr's tokens and the snapshot's `children.subagents.working` go 1 then 0. - 9/9 over 3 repeats, 6/6 over 2 repeats after the last fix; with `agent-adapter-layer.spec.ts` (OpenCode no longer Basic) 4/4 on the merged head. - **확인한 것**: unit tests for every file state (current, stale, edited, foreign, config folder absent, Windows); kit apply, Reinstall and switch-off; Memory receipts from synthetic parts; mailbox next-prompt pull. - **확인하지 못한 것**: the live check with a real OpenCode (PRD D-13) ran but measured nothing (exit 3, every cell UNKNOWN): - run: `scripts/agent-live-check.py --agents opencode`, OpenCode 1.18.30, `opencode-go/deepseek-v4.1-flash`, private pinned Herdr 0.9.3, this branch's hided; - Herdr saw OpenCode idle and ready in every scene, but every screen read came back empty, so all ten scenes timed out at arrival; OpenCode draws a full-screen interface the tool's read does not return; - the tool loads Herdr's integration, not Hide's plugin, so the letter cell is UNKNOWN as well; - nothing unsafe was seen, cleanup was confirmed, and no login or operator setting was changed; - still unproven live: a letter and a refusal reaching the model, B8 after repeated refusals, coexistence with Herdr's plugin, Bun. - The event samples in `tests/fixtures/opencode/events-1.18.30.json` are built from OpenCode's source, not captured. - **확인하지 못한 것**: a machine whose OpenCode reads `$XDG_CONFIG_HOME` loads neither Hide's nor Herdr's plugin from `~/.config/opencode` (a limitation shared with Herdr). <details><summary>Follow-up improvements (not needed for this contract)</summary> - Claude Code's hook is silenced inside OpenCode even where Hide's plugin is not working (Windows, a foreign `hide.js`). - `hide inbox` offers no `ack_command` to OpenCode; letters are confirmed by the plugin only. - Guidance is read once when OpenCode loads the plugin. - A failed confirm can deliver a letter again (at least once); SIGKILL of a helper can orphan its grandchildren; no symlink tests for `hide.js`. - `done` stops growing once finished children are evicted at 512. - No e2e for the question guard (B19) or for an idle pane receiving no input (B5); both are covered below e2e. - A bash command over the helper's 256 KiB input, or a call past the 8 running helpers, passes the spawn guard unchecked (it guards accidents, not a sandbox). - A subagent's `question` from a session the plugin never saw created asks about the subagent's own id, which the Factory guard does not know. - On a timeout the helper is killed but the `hide` call it started ends at its own deadline. - Letter ids are not checked for a leading `-` on pull or confirm; they come from Hide's own ledger. - `herdr-update.yml` takes `actions/setup-node@v4` by tag, as the rest of the repository does. </details> <details><summary>Verification record</summary> - PRD: `agents/prd/opencode-plugin/prd.md` (sha256 91a061f42e55e18f8f0834a17d9b98c8623e8e8cdf3e8d579208af0e8b9d9448) - Base b33fb57 → head bb7bf9d, verified 2026-10-08T20:08:54.127Z: PASS - Verification report: `agents/runs/opencode-plugin/verification-report.json` and `agents/runs/opencode-plugin/verification-report.md`; source fingerprint 01745cef3e161c615ddbf9ebbd8a6d16fb839f090be81b6040ff408874b81036 - Suites: - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0) - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0) - Reviews: - Fidelity (full contract, earlier head): Fix now items fixed before the follow-up rounds; closure confirmed, nothing blocking. - Code (full contract, then follow-ups through the merge with main): Fix now items fixed (plugin eviction, report coalescing, root lookup for question, receipts off the lock); nothing blocking on the merged head. - Security (on the merged head): Fix now 1, a letter or Memory line could close the plugin's own reminder tags; fixed with a test that fails without the fix. Six hardening follow-ups listed above. - Code follow-up (after merging #815/#816/#817): Fix now 1, the OpenCode tests copied or wrote the programs they start, against TESTING.md rule 8; converted to the build's stand-ins. Merge resolutions confirmed. - Evidence: none registered separately. - Changed paths: 63 (see Files changed) - Delivery: mode pr, branch `feat/opencode-plugin`, base `main` </details>
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.
Closes #813
Summary
macOS는 파일을 처음 실행할 때 파일마다 한 번 검사하고, 기기 전체의 그 검사가 한 줄로 기다립니다.
hide-platform,hide-agent-hooks,hide-kit테스트는 helper를 복사하고 stand-in(hide,launchctl,codex,herdr, login shell)을 테스트마다 새로 써서, 부하가 있으면 그 대기가 hook 예산과 kit의 5초 기한 안에 들어갔습니다.이제 stand-in은 body마다 빌드당 파일 하나(읽기 전용, test binary 옆
stand-ins/)이고, 프로세스마다 한 번 시작한 뒤 테스트 폴더에 hard link로 놓습니다. helper는 cargo가 만든 파일을 link합니다.제품 기한과 assertion은 그대로이고, 테스트가 재는 구간에서 준비 비용만 빠졌습니다.
Review
hide-platform/tests/it/stand_ins.rs하나이고, hide-agent-hooks(unit, it)와 hide-kit unit test가#[path]로 포함합니다. 세 crate에 같은 70줄을 두는 대신 고른 것이며, 이 파일이 바뀌면 hide-platform 변경으로 세 crate의 lane이 모두 계획됩니다.READY_GUARD60 s는 준비 단계의 hang guard입니다. 이전 5 s와 달리 파일당 빌드마다 한 번만 치르고, 어떤 제품 기한 안에도 있지 않습니다(nextest slow-timeout period와 같은 값).hide-platform/tests/it/stand_ins.rs- store는 동시 test process가 같이 씁니다(persist_noclobber, 내용 대조, 64개 cap).ready는 stand-in을--help와 임시HOME으로 한 번 돌리므로 body는HOME밖 경로에 쓰면 안 됩니다.spawn_guard.rs,letter_origin.rs,codex_daemon.rs, kitgrok_login_shell, platformuser_agents.rs- stand-in body에 박혀 있던 테스트 폴더 경로를$HOME,${HOME%/*}로 바꿨습니다. 실행 대상 프로그램이HOME을 넘기는 것에 기댑니다.hide-host/src/executable_fixture.rs(ETXTBSY 대응)와install.rs의 helper 스크립트는 같은 부류지만 기한 실패 보고가 없어 바꾸지 않았습니다. 같은 store로 옮길까요?Evidence
hide-agent-hooksit 63개 중 8개가 warm-up 줄(spawn_guard.rs:34,letter_origin.rs:33)에서 실패하는 것을 재현했습니다. 그때 it binary는 31.6 s / 29.7 s.verify-cargo.sh test-scoped를 load 8-35에서 hooks와 kit 11번, main(보호된 작업 반복 테스트가 프로세스 전체 자손 수 대신 자기 자식만 확인한다 #812 포함) 위로 rebase한 뒤 platform, hooks, kit 함께 3번(load 16-26) 돌려 모두 통과(it 63개 5.5-9.1 s, kit 148개 19-41 s; 고치기 전 kit 58.8 s).verify-cargo.sh nextest -p hide-platform -p hide-agent-hooks -p hide-kit가 load 14-20에서 4번 모두 567개 통과. 고치기 전 load 31 nextest에서codex_daemonunit test 2개가 같은 이유로 실패해 포함했고,user_agents::fixture_inspection_failure_does_not_attempt_a_bootout도 부하 실패 보고가 있어 포함했습니다.verify-cargo.sh lint(fmt, workspace clippy-D warnings) 통과. 이 Mac에서target/,$TMPDIR,/tmp는 같은 장치라 모든 배치가 hard link입니다.delivery::tests::diagnostic_claim_precedes_output_and_repeated_cause_is_suppressed가 한 번 실패하고 재실행에서 통과했습니다. 0초 대기 file lock을 다른 thread의 fork가 상속한 descriptor로 잡는 다른 부류로 보이며, 이 PR은 고치지 않았습니다.