Repository navigation
Ship factory-observer - #817
Merged
Merged
Conversation
… notice lines, mode settings, recovery cards
…sions an operator makes
…agent, model and effort
… show what the AI decides as three choices
…d settings and picking a worker on a Task
Ask and block carry up to five choices. Each request is classified on the Factory judgment queue and routed by the Factory's observer mode: the Observer answers what the mode allows and leaves a notice, everything else waits for a person, and the first recorded answer wins. A daily cap counted by local day sends the rest of the day to a person with one notice, and a call the provider never received is not counted. A quiet worker is woken once through what its adapter declares, then diagnosed, then stopped. A vanished worker restarts once in the same worktree. Closing a worker's pane pauses its Task, and a whole Factory can be paused and resumed. Worker candidates carry agent, model and effort; the intake review picks one, a card can pin one, and the launch arguments come from the agent adapter. The macOS notification moves out of the engine.
…Factory AI The core host now reports a worker whose activity it cannot tell as unknown rather than resting, and times a rest from when the core saw the agent's state change. A diagnosis reads the user turn and last answer the worker's adapter declares, and the screen through Herdr's pane.read off the runtime lock. Usage limits and the kit read follow the adapter's declarations instead of agent names. Each Factory judgment carries the Factory AI's agent, model and effort to Hide AI, and a new choice is checked against what Hide AI can run. A pane the operator closes in Hide pauses its Task. Herdr's notification.show call leaves the Factory, and the new Factory codes are pinned in the snapshot enum contract.
…o the CLI ask and block take repeated --choice, add takes --worker <n>, pause and resume take --factory, and worker <task> <n>|auto and ack-notices are new subcommands.
answer takes --change for "다른 답"; a plain answer to a question that is already answered is refused, so a person who answers after the Observer changes nothing.
… and closed workers on the cards
…e and the rest, with every Factory listed when all projects show
…t record and changing Factory AI's decisions on a Task page
… opening the item on click
…rd which text Factory AI read A no-report stop cleared the recovery record, so the Task page's rest line (woke, no reply, diagnosed) never showed on the stopped Task it explains. The record now stays until a retry, a resume or a new start clears it, and the diagnosis remembers which one worker text it read (the worker's turn, its last answer or the screen), pinned as factory_diagnosis_source.
Settings: group captions beside their titles, today's AI use as a bar that stays the primary colour when full, the Hide AI off note with its mark and no day's use, the worker caption for starting on the default, a risk-path note that is the person's again with Hide AI off, and 고급 설정 as the seven rows the frame draws (question deadline, stop times, AI limit, watch, keeping, recovery checkboxes, worker arguments per startable agent) with the other values left to hide factory config. The all-projects list lines its columns up. Your turn: the tab count follows the project filter, a notice line offers 보기, the daily-limit notice names the limit, and a paused Task's action reads 다시 시작. Cards keep Factory AI's line for a stopped worker's diagnosis and draw a paused Task's icon quiet. The Task page names the picked candidate in the trigger and says what the diagnosis read. The gallery scene gains a state per Observer frame with the frames' example data.
A factory-observer target pairs each fx-obs frame, light and dark, with a gallery scene state. The review tool sets such states through the scene address, opens the disclosure or menu a frame draws open, captures each state at its own frame's height, and loads each state fresh.
…ounting the inbox on screen
…resumes, and let Factory AI make Tasks one level deep
…name that reads as an option, and tell Factory AI that worker text is data
… refusals - A worker working again leaves its rest, so the Task page stops counting it. - A paused Factory moves no verified Task toward a merge until it resumes. - A worker pane Hide is closing is never read as gone and restarted. - 모두 확인 clears every shown Factory's notices in one request. - A Task blocked only on a request Factory AI is still sorting is not yet a person's. - A Factory AI call a provider refused before submitting it gives its daily count back. - An automatic restart waiting on a usage reset is not spent until it starts. - A worker candidate description is capped at 200 characters.
…the worker's text
…d calls - A worker whose restart is refused spends its one restart, so the next disappearance stops the Task instead of asking again every tick; only a wait for a usage reset keeps it. - A worker pane Hide closed reads as closing until the engine has taken the close, so no tick between the two restarts it. - A request Factory AI was still sorting when its Task went outside goes to a person, so a revived Task shows it. - No risk-path approval is asked while main is broken, also on resume. - While paused, a verified Task a person must merge shows in merge waiting, and nothing toward an automatic merge is read per tick. - 모두 확인 also clears a closed Factory's notices. - Only calls refused before any model turn give their daily count back; the engine's full queue has its own reason. - An over-long worker description is refused with its own reason and message. - hide-factory's test support is one module of its single test binary.
…erson's merge, through its usual merge checks
…a full queue loses no close The runtime keeps the closed panes until the engine takes them, on its wake-up or before its next tick, and a worker there reads as closing meanwhile. A paused Factory's calls never reach the refund list, so its dead entry goes.
…vailable provider against the daily cap A conflict, a failed check or a person sending a Task back during a pause now leaves the worker asleep with the letter kept for the resume, so no turn starts while the Factory is paused. Hide AI reports a provider past its restart cap as unavailable after the turn answered, so that class counts toward observer_daily_limit.
Main's #804 lets Grok, OpenCode, Pi, omp and Cursor start. The launch options cover every start dialect: those five declare no model or effort, so a start of theirs takes none and a candidate naming one is refused. The start slot check asks whether a waiting Task's own candidates are free of a usage limit, as a start does, instead of whether any startable agent is, so a backlog held by usage limits still reads the machine once a minute.
…keep a pause honest for an agent that cannot sleep A worker's first prompt goes behind its agent's declared prompt flag, so an OpenCode worker gets its prompt rather than a project path. A worker whose agent declares no sleep is refused by the core's sleep, so the engine never counts it asleep; during a pause every reply and send-back waits for the resume, which hands what was held to a sleeping worker and to one that kept working alike. Settings draws no model menu for an agent whose start takes no model, and the refusal names the agent.
…eply only for a Task the resume hands over The pause answer names the Tasks whose agent cannot sleep and keeps its turn. A cancel or an outside takeover leaves such a worker awake rather than counting it asleep, and the core no longer queues a sleep it will refuse. During a pause a reply waits only for a running Task, which the resume delivers; the sleep failure record carries its reason.
…the shared test process's tree Since each crate's integration tests run as one binary, the ipc and programs tests start children beside it, so a count of the whole tree moved under them. The test now checks each child it started, by pid and start time, is gone after its drop.
…g else Reading a child's start time races its exit on macOS and Windows, and a pid check proves less than the count did. The ten guarded runs now happen in a role child, which counts its own tree before and after each, as the test did before the integration tests shared one binary.
# Conflicts: # hide-platform/tests/it/process.rs
…hes no file itself The Observer's context read the attached PRD with std::fs directly, which the core boundary check refuses. Every engine reader now calls attached_prd in engine.rs, the one excused read of that file in the Factory's own store, and the excused count drops from 2 to 1.
design/hide-screens.pen is regenerated by the screen builders and passed 16 MiB once the Factory AI screens joined it, so the scan refused a tracked source as too large. The per-file read stays bounded, now at 32 MiB, and the limit test sets its own small bound instead of restating the checker's.
Raising the bound for all files also let any stray large blob through. The screens file now has its own 32 MiB bound in LARGE_SOURCES, read through read_limit in both the checkout and the index read, and a test proves only that file reads past the bound.
…tte checks The bridge now carries notify and onNotificationOpen for the Factory's macOS notifications, so the attach check's exact key list names them, and the palette spec's stand-in desktop bridge provides them; without them the page's notification hook threw and the shell never drew.
…uires Hide AI checks an answer against the review's schema, which now asks for worker and worker_reason, so the fixture's answers failed every review and each Factory spec stopped at its first card.
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.
Related: PRD
agents/prd/factory-observer/prd.md· main의 #804(작업자 후보가 된 다섯 에이전트), #812(hide-platform 테스트)를 이 브랜치에 받았습니다.Summary
Review
provider_unavailable도 셉니다. Hide AI는 restart cap을 넘은 provider를 턴이 끝난 뒤에 unavailable로 알려서, 세지 않으면 실제 호출이 상한 밖으로 샙니다. 대신 턴 전에 이미 내려간 provider는 한 번 세고, 그 뒤 호출은no_provider로 돌려받습니다(D-34의 "보내지 않은 것은 세지 않는다"에서 한 번 벗어남). hide-ai가 턴 뒤 cap 오류에 거절이 아닌 종류를 주면 없어집니다.--, OpenCode는--prompt)로 갑니다. 이 다섯은 모델·effort, 잠들기, 다음 프롬프트 편지를 선언하지 않아, 후보에 모델을 적으면 거절되고 일시정지해도 하던 턴은 이어지며(worker.sleep_failed기록, 그동안 보낼 것은 다시 시작할 때 전함) 조용해지면 화면을 읽어 진단합니다. 일시정지 답은 잠들지 못한 Task를 이름으로 알려 줍니다. 고급 설정의 작업자 인자도 일곱 줄이 되어 승인된 프레임(세 줄)보다 깁니다. 일시정지가 이 다섯을 멈추지 못하는 것을 받아들일지, 후보에서 뺄지, 그리고 그런 작업자가 있어도 흐름 막대가 "재움"이라고 하는 것을 바꿀지 정해 주세요.check-no-workstation-identity)의 파일당 읽기 상한 16 MiB는 그대로 두고,design/hide-screens.pen하나만 32 MiB 예외(LARGE_SOURCES)로 두었습니다. 이 파일이 Factory AI 프레임 20장(light/dark)으로 19.4 MB가 되어(main은 14.9 MB) 추적 중인 소스를 너무 크다고 거절했기 때문입니다. 화면 파일을 나누거나 압축 직렬화하거나 조각으로 읽는 스캔은 디자인 작업 방식이나 main 도구의 변경이라 이 PR 밖에 두었습니다. 지금 속도면 32 MiB도 화면 몇 번 더 추가하면 찹니다.herdr-core/src/runtime/factory.rs- runtime mutex 안에서 probe와 닫힌 pane 표시, 잠금 아래try_send.herdr-core/src/factory.rs- failure path: 모르는 Factory AI는 다른 에이전트로 바꾸지 않고no_provider, PanesClosed 처리에서 runtime 잠금.hide-factory/src/engine/observer.rs,hide-factory/src/engine.rs- 첫 답 우선, 일시정지 가드, 하루 상한 환불, 재시작 계산.scripts/check-no-workstation-identity.py- privacy gate의 상한 예외. 그 파일도 통째로 읽어 똑같이 검사하고, 상한을 넘으면 실패로 닫힙니다.contracts/snapshot-wire-enums.json- snapshot wire에 새 enum 다섯(알림, 결정 종류, 일시정지 이유, 모드, 진단 출처)과 늘어난 result code·stop reason.desktop/src/main/notify.ts,desktop/src/main/host.ts- 새 IPC: 보낸 쪽 검사와 길이 제한.Evidence
scripts/verify-cargo.sh test(326초)와lint(39초).worker·worker_reason없이 답해 모든 Factory spec이 첫 카드에서 멈춤, cmdk spec의 대역 bridge에 알림 멤버가 없어 화면이 그려지지 않음.scripts/tests210개와 검사 스크립트 7개),verify-web.sh(web 1309개, desktop 162개, lint, typecheck), web e2efactory·factory-question-guard9개와cmdk5개, desktop e2edesktop.spec.ts8개(전용 HOME, state, Herdr)를 통과.check-design-contract.hide-agent-hooksspawn_guard·letter_origin(새로 복사한 실행 파일의 first-exec 5초 제한, 305dc4e의 앞선 실행에서도 한 번),hide-agent-hookscodex_daemon 한 개와hide-kit두 개(5초 fixture 제한).hide-platformprocess::repeated_guarded_work_releases_children_and_capture_resources는 다른 테스트의 자식까지 세던 테스트로, main의 #812가 고쳤고 이 브랜치는 그 파일을 그대로 받았습니다. CI는 nextest가 테스트마다 프로세스를 따로 씁니다.design/hide-screens.pen은node scripts/gen-screens.mjs로 다시 만든 것입니다(fx-obs-direct 프레임의 고급 설정 묶음).추가 증거
승인된 Pen 프레임, 현재 Pen, 실제 화면을 같은 폭·테마·상태로 나란히 놓은 비교입니다(design review, 20장 중 3장).
후속으로 남긴 것(리뷰가 Follow-up으로 낸 것, 이 PR에서 고치지 않음):
awake를 보여 주지 않습니다.Runtime::sleeps와agent_sleep::sleeps_kind가 같은 어댑터 규칙을 두 번 씁니다.agent_choice는 모든 dialect에--model을 넘깁니다(main 코드, Factory 밖).HostBridge타입으로 검사하고 빠진reportLanguage를 채우기(main에도 없음).LARGE_SOURCES에 키 하나, 64 MiB 이하라는 검사와 화면 파일 성장(나누기나 조각 스캔)에 대한 이슈.check_ai가 모든 provider를 확인, nudge 재개 분기, 데몬 시작 직후의 잘못된 Gone, 빨간 main 승인 재질문, 작업자 status·inbox 범위, 알림 빈도, Task당 비용 상한.Verification record
agents/prd/factory-observer/prd.md(sha256 48cdb915c9a6651c78b3ffc91975bdd1dfce24384c90a51ddd08cf14f28ee937)agents/runs/factory-observer/verification-report.jsonandagents/runs/factory-observer/verification-report.md; source fingerprint f4b0d2eb7dd62f1ed9390fb72c53111f8348868dce1f67c47a146ab6833511fdbash scripts/verify-cargo.sh test(exit 0)bash scripts/verify-cargo.sh lint(exit 0)provider_unavailable집계, 일시정지된 Factory가 작업자를 깨움, 잠들 수 없는 작업자를 잠든 것으로 셈, 일시정지 답이 잠들지 못한 Task를 이름으로. 사람의 판단으로 남김: Observer 답을 선택지로 제한할지, B17 바뀐 경로.prd/factory-observer, basemain