Skip to content

Ship factory-observer - #817

Merged
yansfil merged 58 commits into
mainfrom
prd/factory-observer
Oct 8, 2026
Merged

yansfil merged 58 commits into
mainfrom
prd/factory-observer

Conversation

@yansfil

@yansfil yansfil commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Related: PRD agents/prd/factory-observer/prd.md · main의 #804(작업자 후보가 된 다섯 에이전트), #812(hide-platform 테스트)를 이 브랜치에 받았습니다.

Summary

  • 작업자가 ask/block으로 올린 결정 요청을 Factory AI가 A~E로 나누고, Factory의 모드(직접·함께·맡김)에 따라 답하거나 사람에게 보냅니다.
  • AI가 답한 것은 내 차례 아래 알림 줄로 남고 내 차례 숫자에는 세지 않으며, "모두 확인"이 한 번에 지웁니다; 사람이 "다른 답"으로 뒤집을 수 있습니다.
  • 하루 호출 상한(기본 100), 조용한 작업자는 깨우기→진단→멈춤, 사라진 작업자는 한 번 자동 재시작, Hide에서 닫은 pane은 Task 일시정지, 맡김에서 위험 경로만 걸린 머지는 AI가 승인할 수 있습니다.
  • Factory 일시정지/다시 시작, 작업자 후보 1~5개(에이전트·모델·effort)와 카드 검토의 선택, Factory별 AI 에이전트·모델·effort, 선택형 macOS 내 차례 알림을 더했습니다.
  • 설정의 고급 설정은 일곱 줄 다음에 지금 있는 모든 값을 검증·머지·실행·점검·자율 처리 묶음으로 둡니다.

내 차례 - 승인된 Pen 프레임(왼쪽), 현재 Pen, 실제 화면(오른쪽): 결정 요청과 그 아래 AI가 답한 알림 줄

설정(다크) - AI에게 맡기기 모드, 작업자 후보, 고급 설정의 검증·머지·실행·점검·자율 처리 묶음

Review

  • 판단해 주세요: Factory AI의 답이 요청의 선택지 중 하나여야 하는지. PRD가 정하지 않아 지금은 자유 답이고, 프롬프트만 작업자 글을 지시가 아닌 데이터로 다룹니다.
  • 판단해 주세요: 맡김의 위험 경로 머지 판단에 실제로 바뀐 파일 경로를 보낼지. 지금은 B17대로 카드·결정·PRD·위험 경로 패턴만 보내 바뀐 범위를 모릅니다.
  • 판단해 주세요: D-27은 어댑터의 startup guidance 대신 첫 프롬프트의 보고 규칙으로 지켰고, 긴 세션에서 다시 알려 주지 않습니다.
  • 판단해 주세요: Hide AI가 꺼져 있으면 모드 선택이 비활성입니다(승인된 off 프레임대로). B16을 "고를 수는 있다"로 읽을지.
  • 판단해 주세요: 하루 상한에서 provider_unavailable도 셉니다. Hide AI는 restart cap을 넘은 provider를 턴이 끝난 뒤에 unavailable로 알려서, 세지 않으면 실제 호출이 상한 밖으로 샙니다. 대신 턴 전에 이미 내려간 provider는 한 번 세고, 그 뒤 호출은 no_provider로 돌려받습니다(D-34의 "보내지 않은 것은 세지 않는다"에서 한 번 벗어남). hide-ai가 턴 뒤 cap 오류에 거절이 아닌 종류를 주면 없어집니다.
  • 판단해 주세요: main의 #804로 Grok, OpenCode, Pi, omp, Cursor도 시작할 수 있게 되어 B28대로 작업자 후보가 됩니다. 첫 프롬프트는 각 에이전트가 선언한 자리(--, 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: 보낸 쪽 검사와 길이 제한.
  • 비용 검토: 틱마다 도는 작업자당 probe 한 번(잠금 아래 값 복사), AI 호출은 Factory당 하루 상한과 큐 16, 알림은 내 차례 항목이 바뀔 때만 보냅니다.

Evidence

  • 확인한 것: 봉인된 검증 실행이 최종 head 1aec958에서 PASS: scripts/verify-cargo.sh test(326초)와 lint(39초).
  • 확인한 것: 처음 연 head 305dc4e에서 CI가 이 브랜치 때문에 떨어진 것을 모두 고쳤습니다: Observer가 PRD 파일을 직접 읽어 core 경계 검사에 걸림, 위의 스캔 상한, desktop e2e의 host bridge 키 목록, web e2e의 Factory review fixture가 새 schema의 worker·worker_reason 없이 답해 모든 Factory spec이 첫 카드에서 멈춤, cmdk spec의 대역 bridge에 알림 멤버가 없어 화면이 그려지지 않음.
  • 확인한 것: 로컬에서 policy lane 전체(scripts/tests 210개와 검사 스크립트 7개), verify-web.sh(web 1309개, desktop 162개, lint, typecheck), web e2e factory·factory-question-guard 9개와 cmdk 5개, desktop e2e desktop.spec.ts 8개(전용 HOME, state, Herdr)를 통과.
  • 확인한 것: hide-factory 통합 테스트 170개(Observer 47개 포함)가 가짜 provider의 fake world에서 모드 표, 첫 답 우선, 상한과 환불, 깨우기·진단·멈춤, 재시작, 일시정지·재개, 위험 경로 승인을 확인합니다.
  • 확인한 것: herdr-core factory 43개(닫히는 pane, 모르는 Factory AI 거절, 호스트가 닫힘을 받기까지 closing), web 1309개·desktop 162개, check-design-contract.
  • 확인한 것: design review가 head 305dc4e(그 뒤로 화면 코드 변경 없음)에서 승인된 Pen 프레임 20장(10 상태 × light/dark)을 실제 화면과 같은 폭·테마·상태로 비교해 PASS, 겹침과 가로 넘침 0.
  • 확인한 것: 네이티브 리뷰 Fidelity·Code·Security를 head마다(13개 head), Fix now는 모두 고치거나 근거와 함께 반려(Verification record).
  • 흔들린 테스트: 이 브랜치가 건드리지 않은 크레이트에서, 다른 세션의 빌드와 macOS XProtect가 기계를 채운 동안(load 10~35) 봉인 실행이 떨어졌다가 같은 SHA의 단독 실행이나 다음 실행에서 통과했습니다. hide-agent-hooks spawn_guard·letter_origin(새로 복사한 실행 파일의 first-exec 5초 제한, 305dc4e의 앞선 실행에서도 한 번), hide-agent-hooks codex_daemon 한 개와 hide-kit 두 개(5초 fixture 제한). hide-platform process::repeated_guarded_work_releases_children_and_capture_resources는 다른 테스트의 자식까지 세던 테스트로, main의 #812가 고쳤고 이 브랜치는 그 파일을 그대로 받았습니다. CI는 nextest가 테스트마다 프로세스를 따로 씁니다.
  • 확인하지 못한 것: 격리된 Factory의 라이브 실행이 없습니다. 실제 provider 호출(모델·effort 인자), 실제 pane 닫기, 쉬는 pane에 next-prompt 편지가 닿는 것, Electron 알림과 클릭은 단위·통합 테스트로만 봤습니다.
  • 확인하지 못한 것: 네이티브 키보드와 스크린 리더 접근(B29)은 확인하지 않았습니다.
  • 확인하지 못한 것: web e2e와 desktop e2e 전체는 로컬에서 돌리지 않았고, 이 PR의 CI가 돌립니다.
  • 생성물: design/hide-screens.pen은 node scripts/gen-screens.mjs로 다시 만든 것입니다(fx-obs-direct 프레임의 고급 설정 묶음).
추가 증거

승인된 Pen 프레임, 현재 Pen, 실제 화면을 같은 폭·테마·상태로 나란히 놓은 비교입니다(design review, 20장 중 3장).

일시정지된 Factory

Task 상세의 Factory AI 기록

카드 검토의 작업자 선택(다크)

후속으로 남긴 것(리뷰가 Follow-up으로 낸 것, 이 PR에서 고치지 않음):

  • hide-ai가 턴 뒤 restart cap 초과를 거절이 아닌 종류로 알려 주면 D-34의 한 번 초과 집계가 없어집니다.
  • 이미 멈춘 Factory를 다시 일시정지하면 잠들지 못한 작업자가 있어도 보통 문구로 답합니다.
  • 잠들 수 없는 에이전트의 취소된 작업자를 되살리면 편지로만 닿고, 테스트가 없습니다.
  • 웹의 일시정지 버튼은 awake를 보여 주지 않습니다.
  • Runtime::sleeps와 agent_sleep::sleeps_kind가 같은 어댑터 규칙을 두 번 씁니다.
  • 다시 시작할 때 합치는 보류 편지는 각 2000자로 자르지만 합친 크기 상한이 없습니다.
  • 잠들 수 없는 작업자가 계속 일해도 시작 자리는 비워집니다.
  • Home의 agent_choice는 모든 dialect에 --model을 넘깁니다(main 코드, Factory 밖).
  • e2e의 대역 host bridge를 HostBridge 타입으로 검사하고 빠진 reportLanguage를 채우기(main에도 없음). LARGE_SOURCES에 키 하나, 64 MiB 이하라는 검사와 화면 파일 성장(나누기나 조각 스캔)에 대한 이슈.
  • check_ai가 모든 provider를 확인, nudge 재개 분기, 데몬 시작 직후의 잘못된 Gone, 빨간 main 승인 재질문, 작업자 status·inbox 범위, 알림 빈도, Task당 비용 상한.
Verification record
  • PRD: agents/prd/factory-observer/prd.md (sha256 48cdb915c9a6651c78b3ffc91975bdd1dfce24384c90a51ddd08cf14f28ee937)
  • Base b9c45e8 → head 1aec958, verified 2026-10-08T19:21:01.681Z: PASS
  • Verification report: agents/runs/factory-observer/verification-report.json and agents/runs/factory-observer/verification-report.md; source fingerprint f4b0d2eb7dd62f1ed9390fb72c53111f8348868dce1f67c47a146ab6833511fd
  • Suites:
    • S1: GREEN bash scripts/verify-cargo.sh test (exit 0)
    • S2: GREEN bash scripts/verify-cargo.sh lint (exit 0)
  • Reviews (네이티브, 읽기 전용, 조언): heads fefeb46, 92a6342, 8be5f6b, b9fbd3e, 8fddac6, 97b67e4, 4adc78b, e2b24be, 155421e, 305dc4e, fee4d4e, 332a597, 1aec958. 305dc4e 이후의 CI 수정(1687fc6..1aec958)까지 마지막 head 1aec958b에서 세 리뷰 모두 Fix now 없음.
    • Fidelity: Fix now 9개 모두 고침 - 카드 작업자를 에이전트 이름으로(B43), 일시정지 중 보고된 Task의 검사는 재개 때로(B40, B41), 일시정지 중 사람의 머지(B41), 닫힌 Factory의 알림을 모두 확인 아래로, 일시정지 중 실패한 검사의 gate 유지, 일시정지된 Factory가 작업자를 깨움(D-48), Add shared session reader boundaries and installed-agent starts #804 뒤 첫 프롬프트가 선언된 자리로 가지 않음(B28), 잠들 수 없는 작업자를 잠든 것으로 셈(D-48, B40), 그런 작업자가 받는 것을 문서화(D-28). Follow-up: D-27 편차, B16, B17, 빨간 main 승인 재질문, 반복 요청 idempotency, per-tick close 테스트, 재움 칸.
    • Code: Fix now 14개 고침, 1개 근거와 함께 반려(취소 뒤의 판정은 열린 것을 남기지 않음, 테스트로 고정) - rest가 지워지지 않음, 위험 머지 재검사, 일시정지 확인을 앞에서, 닫히는 pane을 사라진 것으로 읽음, 모두 확인을 한 이벤트로, 정렬 중인 Task를 사람 것으로 셈, 턴 뒤에 올 수 있는 환불, 거절된 재시작을 틱마다 반복, 꽉 찬 큐에서 잃는 close, 사람에게 가는 버려진 판정, 빨간 main의 위험 머지, 설명 거절 이유, Add shared session reader boundaries and installed-agent starts #804 뒤 프롬프트 자리, hide-platform 테스트의 start_time 경합(main의 #812로 대체). CI 수정에서는 스캔 상한을 전역으로 올리지 말고 그 파일만 예외로 두라는 제안을 받아 332a5977로 고침. Follow-up: 후속 목록과 같음.
    • Security: Fix now 10개 고침 - AI가 만든 Task의 깊이, 위험 머지 재검사(닫힘, 일시정지, 빨간 main), 모든 프롬프트와 기록에서 작업자 글은 데이터, 모르는 Factory AI는 바꾸지 않고 거절, transient와 over_budget 집계, provider_unavailable 집계, 일시정지된 Factory가 작업자를 깨움, 잠들 수 없는 작업자를 잠든 것으로 셈, 일시정지 답이 잠들지 못한 Task를 이름으로. 사람의 판단으로 남김: Observer 답을 선택지로 제한할지, B17 바뀐 경로.
  • Evidence: 126 registered (6 file, 120 image); paths are local to the run directory
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/report.md
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-all-d.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-all-l.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-auto-d.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-auto-l.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-cards-d.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-cards-l.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-direct-d.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-direct-l.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-off-d.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-off-l.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-paused-d.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-paused-l.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-pick-d.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-pick-l.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-set-d.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-set-l.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-task-d.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-task-l.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-turn-d.png
    • agents/runs/factory-observer/design/review/20261008-152644-8aa1f2/compare/fx-obs-turn-l.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/report.md
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-all-d.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-all-l.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-auto-d.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-auto-l.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-cards-d.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-cards-l.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-direct-d.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-direct-l.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-off-d.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-off-l.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-paused-d.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-paused-l.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-pick-d.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-pick-l.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-set-d.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-set-l.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-task-d.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-task-l.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-turn-d.png
    • agents/runs/factory-observer/design/review/20261008-154808-b00171/compare/fx-obs-turn-l.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/report.md
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-all-d.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-all-l.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-auto-d.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-auto-l.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-cards-d.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-cards-l.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-direct-d.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-direct-l.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-off-d.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-off-l.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-paused-d.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-paused-l.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-pick-d.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-pick-l.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-set-d.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-set-l.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-task-d.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-task-l.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-turn-d.png
    • agents/runs/factory-observer/design/review/20261008-162546-db5cb3/compare/fx-obs-turn-l.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/report.md
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-all-d.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-all-l.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-auto-d.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-auto-l.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-cards-d.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-cards-l.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-direct-d.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-direct-l.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-off-d.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-off-l.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-paused-d.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-paused-l.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-pick-d.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-pick-l.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-set-d.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-set-l.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-task-d.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-task-l.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-turn-d.png
    • agents/runs/factory-observer/design/review/20261008-155721-2282fd/compare/fx-obs-turn-l.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/report.md
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-all-d.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-all-l.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-auto-d.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-auto-l.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-cards-d.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-cards-l.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-direct-d.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-direct-l.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-off-d.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-off-l.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-paused-d.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-paused-l.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-pick-d.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-pick-l.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-set-d.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-set-l.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-task-d.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-task-l.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-turn-d.png
    • agents/runs/factory-observer/design/review/20261008-164808-2bb3c7/compare/fx-obs-turn-l.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/report.md
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-all-d.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-all-l.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-auto-d.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-auto-l.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-cards-d.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-cards-l.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-direct-d.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-direct-l.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-off-d.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-off-l.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-paused-d.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-paused-l.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-pick-d.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-pick-l.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-set-d.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-set-l.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-task-d.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-task-l.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-turn-d.png
    • agents/runs/factory-observer/design/review/20261008-184022-7fe380/compare/fx-obs-turn-l.png
  • Changed paths: 94 (see Files changed)
  • Delivery: mode pr, branch prd/factory-observer, base main

yansfil added 30 commits October 8, 2026 13:26
… notice lines, mode settings, recovery cards
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.
…e and the rest, with every Factory listed when all projects show
…t record and changing Factory AI's decisions on a Task page
…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.
yansfil added 21 commits October 9, 2026 01:05
…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.
…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 yansfil changed the title Factory AI가 작업자의 결정 요청에 모드대로 답하고, 조용한 작업자를 깨우고 진단하며, Factory를 일시정지한다 Ship factory-observer Oct 8, 2026
@yansfil
yansfil merged commit 4f1645c into main Oct 8, 2026
20 checks passed
@yansfil
yansfil deleted the prd/factory-observer branch October 8, 2026 19:42
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>
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