Skip to content

Add isolated bell safety and mail delivery checks - #816

Merged
yansfil merged 84 commits into
mainfrom
feat/agent-live-check
Oct 8, 2026
Merged

yansfil merged 84 commits into
mainfrom
feat/agent-live-check

Conversation

@yansfil

@yansfil yansfil commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • 설치된 일곱 CLI의 열 장면에서 종 안전과 실제 편지 전달을 재측정하는 로컬 도구를 추가합니다.
  • 고정 Herdr와 후보 daemon을 개인 소켓·상태·checkout으로 실행하고 JSON/Markdown 보고서를 남깁니다.
  • 도달·효과·전달을 별도로 확인하고, 불명확하거나 누락된 장면은 UNKNOWN으로 남깁니다.

Review

  • 판단: 기록된 모델·버전·manifest와 도달한 장면 범위 안에서만 종 활성화 근거로 사용해야 합니다.
  • 파일: sandbox.py, protection.py, processes.py의 운영자 경로 보호·소유권·실패 정리를 봐 주세요.
  • 파일: scenes.py, delivery.py, recipes의 양성 도달 증거와 정확한 assistant 턴 판정을 봐 주세요.
  • fixture: 읽을 수 없는 외부 고아의 권한 오류를 두 OS에서 고정했으며 제품 코드와 ownership/unknown 기대는 유지합니다.
  • 경계: 공유 설정은 읽기 전용이며 native history는 기록될 수 있습니다. 폴더 밖 쓰기 전체를 막는 보장은 없습니다.
  • 경계: marker를 지운 detached 후손은 귀속되지 않을 수 있고, PID 신호·credential opener 검사는 원자적이지 않습니다.
  • 비용: 실행별 guardian·프로세스 조사에 고정 시간·프로세스·RSS·출력 상한을 적용합니다. 실측 모델 호출 수는 미측정입니다.
  • 후속 P2: 전체 실행 기한 만료를 일반 scene UNKNOWN과 구분하는 보고 분류.
  • 후속 P2: delivery timeout 뒤 이미 기록된 rest 행이 중복되는 보고 경로.
  • 후속 P2: 첫 agent 시작 전 fixture close가 미설정 integration_pane을 참조하는 실패 경로.
  • 후속 P3: credential unavailable 뒤 다음 provider까지 진행하는 CLI 수준 fixture 보강.
  • 후속 P3: credential DB/WAL/SHM의 원본·개인 복사본 경로 라벨 구분.

Evidence

  • Linux 권한 fixture 수정 후 새 CI의 모든 필수 검사가 통과했습니다.
  • Python 전체 312건과 두 OS 권한 거절 분기가 통과했으며 첫 locale 환경 실패 로그도 보존합니다.
  • 합성 e2e는 병합 전 후보에서 선행 2건과 승인된 재실행 4건이 통과한 2+4 합성이며, 단일 full-six PASS 기록은 없습니다.
  • 두 shim은 각각 열 장면에 도달했고 정리 assertion을 통과했으며 retry는 0이었습니다.
  • 실제 기본 일곱 CLI는 70행 중 11 reached, 41 timeout, 18 skipped였고 모두 delivery UNKNOWN입니다.
  • Grok·Pi startup은 종 입력 뒤 개인 설정 변경을 unsafe로 기록했으며 두 CLI는 당시 종 대상이 아니었습니다.
  • Codex CLI는 열 장면 모두 시작 거절, Pi·omp는 인증 미충족을 기록했습니다. 로그인은 시도하지 않았습니다.
  • 별도 Claude Code 실측의 열 장면/11행은 reached 4, timeout 7이며 rest 중복 보고는 위 P2로 남겼습니다.
  • native cleanup receipt는 Claude Code 1,139개, 기본 일곱 CLI 3,925개가 확인됐으며 과거 누락 보고는 보존합니다.
  • 실패했던 hide-kit 13건은 기한·assertion 변경 없이 한 번 통과했고, 병합 전 sealed S1/S2도 통과했습니다.
  • 현재 후보의 sealed S1/S2가 통과했고 Rust는 3,418 passed, 0 failed, 21 existing ignored입니다.
  • 이전 main fixture 실패는 보존했으며, 자손 수 flaky 수정 병합 후 검증이 통과했습니다.
  • native 기록은 main 병합 전 측정이며, 병합 후 결정적 검증과 별도로 아래 기록에 적습니다.
Verification record
  • PRD: agents/prd/agent-live-check/prd.md (sha256 2908f4a4d6a2a43f9da330aecca6075c6f6cbb0b9f5a7bb00b2548fd55c7fa70)
  • Base b9c45e8 → head 8012b47, verified 2026-10-08T19:20:13.399Z: PASS
  • Verification report: agents/runs/agent-live-check/verification-report.json and agents/runs/agent-live-check/verification-report.md; source fingerprint 00f036105538f1d42d3a2505615b142806fcf0b4b867ff95992a2f8c955fde12
  • Suites:
    • S1: GREEN bash scripts/verify-cargo.sh test (exit 0)
    • S2: GREEN bash scripts/verify-cargo.sh lint (exit 0)
  • Fidelity: reviewed 886dc3cc0fa08567fe500d23a438167a29ad6bc7; Fix now 0 P0/P1 under frozen protection scope; two P2 deferred.
  • Code: reviewed 886dc3cc0fa08567fe500d23a438167a29ad6bc7; Fix now 0 P0/P1; two P2 deferred.
  • Security: reviewed 886dc3cc0fa08567fe500d23a438167a29ad6bc7; Fix now 0 P0/P1; three P2 and two P3 deferred.
  • Code merge follow-ups: 8f193e3ba4a2fc895a7048ce2637076be346fdf1, then d4f063d508fae9a11069eb1aa41f5f3177ca8612; 0 new P0/P1, 0 new compatibility findings, five retained follow-ups; all 43 feature blobs unchanged in the second merge.
  • Code fixture follow-up: reviewed 8012b476e8a53d7dfad2161e5ba0a73f0d0bfa70; 0 new P0/P1 or compatibility findings, five retained follow-ups; report SHA256 81d9291679bae1be6640bd471092861f2357681fd3cdf549f6904c6cfe725897.
  • Fixture-only delta: one method, 11 insertions / 6 deletions; Darwin EACCES and Linux PermissionError exercise the real ownership function with exact ownership={} and unknown=[orphan] assertions; production code unchanged.
  • Python: 312/312 passed in 98.058 s under owned subprocess LC_ALL=en_US.UTF-8; focused toolchain and two-platform denial tests passed (2 tests, 1.432 s); no skips added.
  • Initial Python run retained: 312 tests, one unchanged toolchain-stderr failure from inherited unsupported C.UTF-8 on macOS; no source, assertion, deadline or global environment edit for the supported-locale rerun.
  • Evidence: 1,078 registered inputs (337 log, 741 file), plus two current generated suite logs; 1,080 state artifacts stay local and are not published.
  • Current attempt 9480ce43-dc38-4d97-a6b4-480a2bde808f: S1 325.040 s, S2 4.896 s; sourceChangedAfterVerification=false, inputsChangedAfterVerification=false; input fingerprint 6f06e572fd48f5614f1b47201e6a6a41a4ba9131397dbb57b099c1d9369b2220.
  • Rust summaries: 3,418 passed, 0 failed, 21 existing ignored across 45 groups; no quarantine added.
  • Earlier same-head attempt passed both suites, then required ship fetch observed main advancing to 404a09c835da9f88f6434e54ae72a8cf22138a7e, making delivery STALE through baseTip identity movement; recorded Root3081 ref-only repeat.
  • Next attempt retained genuine S1 failure in unmodified hide-agent-hooks: fake codex app-server no_server expected Unsupported, got initialize TimedOut at its unchanged 5 s request bound; crate 62 passed / 1 failed, partial workspace 1,981 passed / 1 failed / 5 ignored; S2 passed.
  • Final third attempt passed under Root3114 fixture-class retry authority; failed stdout, reports and hashes remain registered; no assertion, retry policy, timeout or resource cap was weakened.
  • Final admission: 30-second gate sampling, 31.231 s total until fresh admission at load 11.70117, free 16,128,442,368 bytes; maximum wait remains 1,800 s.
  • Driven load samples: 11.22070, 18.14893, 23.36963, 34.13037; closed 30.52783; low admission is not continuous low execution load.
  • Earlier pre-fix CI run 37826053187 retained: Linux policy failed this unreadable-orphan fixture, Linux web lanes reached the same failure; Windows fetch timeout was reported separately as network preparation failure.
  • Current-head CI: verify run 37831509388 SUCCESS on 8012b476e8a53d7dfad2161e5ba0a73f0d0bfa70; 17 verify jobs succeeded and two plan-selected jobs skipped; the separate design contract also passed.
  • CI retry audit: all 12 test-lane reports say no flaky test; Linux web 228 passed, Windows web 36 passed, desktop 62 passed / 8 existing skipped; Linux policy Python 312 tests with 12 existing platform skips. Existing doorbell quarantine issues doorbell 테스트 fixture에 실제 시계로 도는 두 번째 poller가 있어 가끔 실패한다 #798, Flaky test: herdr-core delivery::doorbell::tests::a_pane_herdr_reports_no_readiness_for_is_belled_at_rest_like_a_started_one #802, Flaky test: herdr-core delivery::doorbell::tests::a_plan_waiting_for_approval_holds_the_letter_until_the_session_moves_on #809 and Flaky test: herdr-core delivery::doorbell::tests::a_letter_held_by_herdr_is_belled_once_the_cause_clears_while_the_pane_stays_put #814 remain open and are not declared fixed.
  • Premerge: repository entrypoint PASS against main 4f1645c83c0c7f42ab6abad8b17da07b759ed281, all 13 checks passed; owned temporary worktree removed, before/after worktree inventory identical. Fresh admission load 5.29346, free 14,341,345,280 bytes.
  • Sealed PASS observed base tip 404a09c835da9f88f6434e54ae72a8cf22138a7e; Root3127 and CONTRIBUTING permit current-head CI plus premerge against later main without requiring branch ancestry or relabelling native evidence.
  • Earlier failures retained: descendant equality actual 4 / expected 5, then private user-agent fixture missing calls receipt; no hidden failure deletion.
  • Cleanup scope: Python and sealed wrappers completed; no new native-provider measurement or independent exhaustive Rust-fixture descendant census; historical native receipts below remain historical.
  • Historical native measurement head: 886dc3cc0fa08567fe500d23a438167a29ad6bc7; no new native/provider execution on either merged head.
  • Claude Code archive SHA256 c062e7eba130752041bb76626aaa5a954757287cdd3e15ba0edbf371974b21d9: 1,171 files / 1,139 confirmed receipts.
  • Default-seven archive SHA256 d1f361b839d8bc06bd7b5c388af491612620c675b2fa26b5448908f546c8cb50: 4,011 files / 3,925 confirmed receipts.
  • Historical native cleanup fields all true; prior reportless gaps preserved; provider/model call count not_measured.
  • Native observed versions/requested models and arrival counts (reached/timeout/skipped):
    • claude-code 2.1.294, haiku: 3/7/0, UNKNOWN, loaded_version_observed.
    • codex 0.161.0, gpt-6-luna: 0/10/0, UNKNOWN, integrity_unproven.
    • cursor 2026.10.01-e373342, gpt-6-luna: 4/6/0, UNKNOWN, not_observed.
    • grok 1.0.46, grok-4.5: 3/7/0, UNSAFE, loaded_version_observed.
    • omp 18.7.0, gpt-6-luna: 0/0/10, skipped, loaded_version_observed.
    • opencode 1.18.30, openai/gpt-6-luna: 0/10/0, UNKNOWN, not_observed.
    • pi 1.0.4, openai-codex/gpt-6-luna: 1/1/8, UNSAFE, loaded_version_observed.
  • All seven delivery verdicts UNKNOWN; no authenticated resume/fork claim.
  • Changed paths: 43 (see Files changed)
  • Merge: normal merge commit 64ca97d9d4895d07b55c981ff0aa634df87b86cb with parents 4f1645c83c0c7f42ab6abad8b17da07b759ed281 and verified feature head 8012b476e8a53d7dfad2161e5ba0a73f0d0bfa70.
  • Post-merge main: verify run 37834898822 SUCCESS on containing head b33fb578a8b55ec6cbca350ba3370d43f671d41c; 17 jobs succeeded, two plan-selected jobs skipped, all 12 test-lane reports say no flaky test. Earlier pending run 37834599380 was cancelled before any job; it is not counted as a pass.
  • Post-merge local cleanup under Root3163: only this worktree target directory removed (9,276,496 KiB, 12,855 file entries / 2,022 directory entries); worktree and local run evidence retained, state and sealed report hashes unchanged, Git source/index clean. Cleanup receipt SHA256 a81adb3e976de4195bcf614a9131e784027c3b6ebbd67913d33690132c648cc8.
  • Delivery: mode pr, branch feat/agent-live-check, base main

yansfil added 30 commits October 8, 2026 02:12
@yansfil
yansfil merged commit 64ca97d into main Oct 8, 2026
20 checks passed
@yansfil
yansfil deleted the feat/agent-live-check branch October 8, 2026 19:47
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>
yansfil added a commit that referenced this pull request Nov 14, 2026
Two waits failed on Windows without saying what the other side held.
`startFlow` waited for the beta project row to be drawn (#816), and
`setAgentState` waited for a pane to read the state the fixture typed into it
(#822); a run that gave up left only the timeout.

Both now record what they asked for and what the core or the page held when
the wait ended, and rethrow the wait's own error unchanged. Neither wait,
retry nor expectation changed, and neither has been reproduced since.
yansfil added a commit that referenced this pull request Nov 15, 2026
A failure dump's read returns one object of page and daemon reads, and a
read left unawaited inside it serialized as {}: the pane-connection and
s2 dumps for #859 and #816, and the s3 log dump's screen, recorded
nothing. dumpOnFailure now settles every promise in the answer before it
serializes, keeping a rejected read as its reason, and the two dumps
await their reads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
yansfil added a commit that referenced this pull request Nov 15, 2026
A failure dump's read returns one object of page and daemon reads, and a
read left unawaited inside it serialized as {}: the pane-connection and
s2 dumps for #859 and #816, and the s3 log dump's screen, recorded
nothing. dumpOnFailure now settles every promise in the answer before it
serializes, keeping a rejected read as its reason, and the two dumps
await their reads.
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