Skip to content

Fence retired remote coordinator writes - #758

Merged
yansfil merged 4 commits into
mainfrom
fix/registration-coordinator-fence
Oct 7, 2026
Merged

yansfil merged 4 commits into
mainfrom
fix/registration-coordinator-fence

Conversation

@yansfil

@yansfil yansfil commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Related: #753

Summary

  • On retry, a retired coordinator could overwrite its replacement and end live registrations or watches.
  • Check installed connector identity under all four coordinator write locks, including after projection.
  • Admit current bootstrap before connected status and preserve authoritative disappearance handling.

Review

  • Focus: identity lifetime across retry/removal; current bootstrap and genuine child-only pane loss.
  • herdr-core/src/session_sync/coordinator.rs: ownership must be checked before each affected mutation.
  • herdr-core/src/runtime.rs: installed connector identity must work before connected status.
  • Cost: one map lookup, transient Arc clone/drop and pointer comparison per check; two checks per publication.
  • Added allocations, retained state, I/O, workers, queues, timers and notification fan-out: zero.

Evidence

  • RED: one positive case passed and six intended stale-write assertions failed after healthy preconditions.
  • The initial fixture compile error executed zero tests and is excluded from reproduction evidence.
  • Local: focused 7/7, format and lint passed; workspace 3,220 passed, 0 failed, 17 ignored across 85 summaries.
  • All seven fence cases also passed in the ordinary workspace run; nine static gates passed.
  • Final Code, Fidelity and independent Security reviews found no Fix now at the checked head.
  • Private fixtures exercise real coordinator/watch callbacks and durable ledger outcomes.
  • Ignored cases include opt-in remote/provider probes and subprocess entry points.
  • Logs include delivery_unavailable; fixture teardown is a plausible explanation, with ordering unproven.
  • CI: verify and Design contract passed at the checked head, both on their first workflow attempt.
  • CI Rust: 2,070 passed; private SSH mailbox: 1 passed; Linux/Windows OS contracts and Windows checks passed.
  • Browser CI: Linux 219 passed + 1 flaky; Windows 35 passed + 1 flaky, each flaky case passed on retry.
  • Tracked flaky cases: Flaky test: a real external Herdr focus is followed #759 (daemon launch) and Flaky test: a session started before the hook wears the chip, Not now keeps it, and Reopen continues the conversation and connects it #760 (process list); causality to this change is unproven.
  • Both flaky cases are tracked for resolution by 2026-10-14; first-attempt behavior remains unproven.
  • Planned skips: macOS OS contract, desktop e2e, packaging, and standalone web/desktop checks.
  • Unverified: actual SSH reconnect, live handoff/restart, native agent/app behavior and measured performance.

@yansfil
yansfil merged commit 04af60e into main Oct 7, 2026
20 checks passed
@yansfil
yansfil deleted the fix/registration-coordinator-fence branch October 7, 2026 20:58
yansfil added a commit that referenced this pull request Oct 7, 2026
Related: #749, #753, #758

## Summary

- 분산된 상태 판단을 `herdr-core/src/agent_state/`로 모아 웹과 휴대폰이 core 투영을 그립니다.
- 다섯 상태 축, 그룹·요청 동사·주의·push 전이, PR/issue/duty 연결과
checkout/project/device/전체 집계를 이전했습니다.
- 기존 화면 값을 회귀 테스트로 고정했고, 상태 모델과 아키텍처 가이드에 소유권을 함께 정리했습니다.

전후 Projects 캡처의 상태·배지·집계는 같습니다.
이전 화면은 기준 소스 archive로 재현했으며, 이후 화면의 Factory 메뉴와 행 이동은 별도로 병합된 main
변경입니다.
두 이미지는 초기 추출의 gallery 비교이며 최종 커밋의 macOS 캡처는 아닙니다.

![이전: 기준 소스로 재구성한 Projects. 상태·배지·집계 비교용
gallery.](https://github.com/yansfil/pr-assets/blob/main/hide/agent-state-module/4fed648/before-sidebar.png?raw=true)

![이후: 추출 후 Projects gallery. 같은 상태·배지·집계이며 Factory는 별도 main
변경.](https://github.com/yansfil/pr-assets/blob/main/hide/agent-state-module/4fed648/after-sidebar.png?raw=true)

## Review

- **기존 해석**: 읽은 질문의 Seen+Answer, 위임 행의 Working/Seen, Requests 자식 제외, 물리
수와 루트 수의 차이를 보존했습니다.
- **선택 규칙**: 중복 pane의 첫/마지막/전체 선택과 로컬 pet 집계도 기존 화면별 규칙을 유지했습니다.
- **주의 파일**: `agent_state/`, `runtime/agents.rs`, `model.rs`의
mutex·snapshot 비용과 웹·hided의 판단 소비 경계를 봐 주세요.
- **비용**: 입력 비교 후 변경 시 집계하며 입력/출력 한 쌍을 보관합니다. 새 worker·timer·큐나 mutex 안의
I/O·subprocess·큰 직렬화는 없습니다.
- **측정**: 이전 통합의 2-agent driven 21프레임은 같고 payload는 426,263→694,865
bytes(+63.0%)입니다. 유휴는 1프레임/32,529 bytes입니다.
- **한계**: 목록 크기는 현재 작업량을 따르며 숫자 cap은 없습니다. 공유 머신 부하·중간 main 변경을 통제하지 않아
대규모 비용과 지연은 미확인입니다.

## Evidence

- **CI**: 필수 verify와 design contract 통과. E2E 317개가 통과했고 12개 flaky 보고 모두
실패·flaky가 없었습니다.
- **최종 검증**: workspace Rust 3,237개 PASS·17개 ignored, lint PASS. 현재 CLI
빌드·코디네이터 교체 방어 7개·격리 그래프 E2E 2개도 통과했습니다.
- **웹·폰**: 이전 통합 웹 1,266개·scope 11개·typecheck/lint/web·desktop build 통과
후 해당 코드가 유지됐습니다. 폰·push 회귀와 실제 격리 폰 흐름도 확인했습니다.
- **화면**: 격리 후보 macOS 창 PNG 3개, 현재 그래프 renderer PNG와 기존
sidebar·phone·device 비교를 각 실행 시점·방법에 맞춰 검토했습니다.
- **확인하지 못한 것**: 최종 커밋의 OS 캡처·성능 재측정, 설치 bundle, 실제 SSH 기기·물리 폰·외부 push,
전체 로컬 웹 E2E와 fleet/깊은 계보·입력/렌더 지연입니다.
- **생성물**: gallery의 `agentStates.json`, `agentScopes.json`,
`cmdkScopes.json`은 기존 화면 값을 고정한 fixture입니다.

<details><summary>Verification record</summary>

- PRD: `agents/prd/agent-state-module/prd.md` (sha256
544eecba9adc7c528111d1b916192f765d7d807f50173446a96ec48ea84cce73)
- Base 04af60e → head 4fed648, verified 2026-10-07T22:07:51.839Z: PASS
- Verification report:
`agents/runs/agent-state-module/verification-report.json` and
`agents/runs/agent-state-module/verification-report.md`; source
fingerprint
444e26c6ee17e5c55dde8ef62950093dead4b273dbaba0282eb869001d2c43c3
- Suites:
  - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0)
  - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0)
- Fidelity: reviewed `4fed6484` with the final PASS and all 107
registered identities; no Fix now. Complete B1-B12 responsibility
retained; inherited retired-coordinator P2 and F1-F4/C1-C3 are closed.
Follow-ups: independent differential corpus, larger/deeper workload
measurements and optional future RequestView dependency coverage.
- Code: reviewed `4fed6484` with the same final PASS and evidence; no
Fix now. Inherited P2 and previous findings are closed. Follow-ups:
shared independent differential fixtures and larger/deeper workload
measurements.
- Material evidence: 105 registered (30 file, 43 log, 32 screenshot);
paths are local to the run directory
  - agents/runs/agent-state-module/final/observations.md
  - agents/runs/agent-state-module/final/source-audit.md
  - agents/runs/agent-state-module/final/performance.md
  - agents/runs/agent-state-module/baseline/publication-measure.json
  - agents/runs/agent-state-module/final/publication-measure.json
  - agents/runs/agent-state-module/final/locale-reproduction.json
  - agents/runs/agent-state-module/final/locale-C-UTF-8.log
  - agents/runs/agent-state-module/final/locale-en-US-UTF-8.log
  - agents/runs/agent-state-module/final/scripts-tests-valid-locale.log
  - agents/runs/agent-state-module/baseline/web-e2e-standard.log
  - agents/runs/agent-state-module/final/web-e2e.log
  - agents/runs/agent-state-module/final-phone/web-e2e.log
  - agents/runs/agent-state-module/final/native-current.log
  - agents/runs/agent-state-module/phone-count-core.log
  - agents/runs/agent-state-module/phone-count-web.log
  - agents/runs/agent-state-module/final-web.log
  - agents/runs/agent-state-module/final/herdr-contract.log
  - agents/runs/agent-state-module/final/gate-0.log
  - agents/runs/agent-state-module/final/gate-1.log
  - agents/runs/agent-state-module/final/gate-2.log
  - agents/runs/agent-state-module/final/gate-3.log
  - agents/runs/agent-state-module/final/gate-4.log
  - agents/runs/agent-state-module/final/gate-5.log
  - agents/runs/agent-state-module/final/gate-6.log
  - agents/runs/agent-state-module/final/gate-7.log
  - agents/runs/agent-state-module/baseline/electron-agents.png
  - agents/runs/agent-state-module/final-current/electron-agents.png
  - agents/runs/agent-state-module/baseline/aside-requests.png
  - agents/runs/agent-state-module/final/aside-requests.png
  - agents/runs/agent-state-module/baseline/aside-graph.png
  - agents/runs/agent-state-module/final/aside-graph.png
  - agents/runs/agent-state-module/final/before-sidebar.png
  - agents/runs/agent-state-module/final/after-sidebar.png
- agents/runs/agent-state-module/baseline/screens/mobile-phone-list.png
  - agents/runs/agent-state-module/final-phone/e2e/mobile-phone-list.png
- agents/runs/agent-state-module/final-phone/e2e/mobile-phone-detail.png
  - agents/runs/agent-state-module/final/asm-device-before-two.png
  - agents/runs/agent-state-module/final/asm-device-before-busy.png
  - agents/runs/agent-state-module/final/asm-device-before-offline.png
  - agents/runs/agent-state-module/final/asm-device-after-two.png
  - agents/runs/agent-state-module/final/asm-device-after-busy.png
  - agents/runs/agent-state-module/final/asm-device-after-offline.png
  - agents/runs/agent-state-module/final-current/native-provenance.json
  - agents/runs/agent-state-module/integration-749/observations.md
  - agents/runs/agent-state-module/integration-749/build-focused.json
- agents/runs/agent-state-module/integration-749/binary-provenance.json
  - agents/runs/agent-state-module/integration-749/core.log
  - agents/runs/agent-state-module/integration-749/cli.log
  - agents/runs/agent-state-module/integration-749-web-all-fixed.log
  - agents/runs/agent-state-module/integration-749-typecheck.log
  - agents/runs/agent-state-module/integration-749-lint.log
  - agents/runs/agent-state-module/integration-749-build.log
  - agents/runs/agent-state-module/integration-749-desktop-build.log
  - agents/runs/agent-state-module/integration-749/graph-e2e.log
-
agents/runs/agent-state-module/integration-749/graph-e2e/graph-cross-project-all-dark.png
-
agents/runs/agent-state-module/integration-749/graph-e2e/graph-cross-project-all-light.png
-
agents/runs/agent-state-module/integration-749/graph-e2e/graph-cross-project-opened.png
-
agents/runs/agent-state-module/integration-749/graph-e2e/graph-cross-project-selected-light.png
  - agents/runs/agent-state-module/integration-native/os-provenance.json
  - agents/runs/agent-state-module/integration-native/cleanup.json
  - agents/runs/agent-state-module/integration-native/launch.log
  - agents/runs/agent-state-module/integration-native/launch-retry.log
  - agents/runs/agent-state-module/integration-native/os-agents.png
  - agents/runs/agent-state-module/integration-native/os-projects.png
  - agents/runs/agent-state-module/integration-native/os-requests.png
  - agents/runs/agent-state-module/integration-753/observations.md
  - agents/runs/agent-state-module/integration-753/cli.log
  - agents/runs/agent-state-module/integration-753/cli-execution.json
- agents/runs/agent-state-module/integration-753/binary-provenance.json
-
agents/runs/agent-state-module/integration-753/compiler-return-sampler.json
  - agents/runs/agent-state-module/integration-753/e2e.log
  - agents/runs/agent-state-module/integration-753/e2e-execution.json
  - agents/runs/agent-state-module/integration-753/measure.log
- agents/runs/agent-state-module/integration-753/measure-execution.json
-
agents/runs/agent-state-module/integration-753/publication-measure.json
  - agents/runs/agent-state-module/integration-753/cleanup.json
-
agents/runs/agent-state-module/integration-753/graph-e2e/graph-cross-project-all-dark.png
-
agents/runs/agent-state-module/integration-753/graph-e2e/graph-cross-project-all-light.png
-
agents/runs/agent-state-module/integration-753/graph-e2e/graph-cross-project-opened.png
-
agents/runs/agent-state-module/integration-753/graph-e2e/graph-cross-project-selected-light.png
  - agents/runs/agent-state-module/integration-753-ignore.log
  - agents/runs/agent-state-module/integration-753-asset.log
  - agents/runs/agent-state-module/integration-753-lock.log
  - agents/runs/agent-state-module/integration-753-identity.log
  - agents/runs/agent-state-module/integration-753-worktree.log
  - agents/runs/agent-state-module/integration-753-pin.log
  - agents/runs/agent-state-module/integration-753-machine.log
  - agents/runs/agent-state-module/integration-753-design.log
  - agents/runs/agent-state-module/integration-758/candidate.json
  - agents/runs/agent-state-module/integration-758/source-continuity.md
- agents/runs/agent-state-module/integration-758/binary-provenance.json
  - agents/runs/agent-state-module/integration-758/focused.log
- agents/runs/agent-state-module/integration-758/focused-execution.json
  - agents/runs/agent-state-module/integration-758/cli.log
  - agents/runs/agent-state-module/integration-758/cli-execution.json
  - agents/runs/agent-state-module/integration-758/e2e.log
  - agents/runs/agent-state-module/integration-758/e2e-execution.json
  - agents/runs/agent-state-module/integration-758/cleanup.json
  - agents/runs/agent-state-module/integration-758/observations.md
-
agents/runs/agent-state-module/integration-758/graph-e2e/graph-cross-project-all-dark.png
-
agents/runs/agent-state-module/integration-758/graph-e2e/graph-cross-project-all-light.png
-
agents/runs/agent-state-module/integration-758/graph-e2e/graph-cross-project-opened.png
-
agents/runs/agent-state-module/integration-758/graph-e2e/graph-cross-project-selected-light.png
- agents/runs/agent-state-module/integration-758/monitor-interruption.md
  - agents/runs/agent-state-module/integration-758/verify-execution.json
- Changed paths: 158 (see Files changed)
- Delivery: mode local, branch `prd/agent-state-module`, base `main`

- Current S1: 3,237 passed, 0 failed, 17 ignored across 85 result
blocks; 196.318 seconds. Current S2 formatting/clippy: exit 0, 20.520
seconds.
- Report JSON SHA256:
`bb1b2a9aefa99992641c60efd4a8525d5ecb1140faef808470b936e18dd33525`;
Markdown SHA256:
`f0bef321e08310d0bf0ffa7c35a23040e44e21887c82c9803622b25abd42bdf7`.
- Evidence identity: 107 registered paths, comprising the 105 material
entries above and two fresh suite logs; all hashes independently checked
by both reviewers.
- Captures: reconstructed baseline source `9f144877` and extraction
gallery `132a875e`; genuine isolated OCU OS PNGs at `73afb9b2`, PID
75917/window 34005. The latter show graph/question/Projects/Requests and
do not add an Agents-sidebar-list scenario. Current graph Chromium
screenshots use the 4fed CLI and unchanged web build from 73.
- Build provenance: recorded 4fed hided/hide hashes identify the
CLI/E2E-time build; subsequent workspace tests overwrite ignored target
binaries, so those hashes do not assert present on-disk equality.
- Measurement: two local synthetic agents at `05515bdf`; idle 1
frame/32,529 bytes; driven 21 frames/694,865 bytes in 12.270 seconds,
versus 426,263 baseline bytes (+63.0132%). Uncontrolled external load
and intervening main changes prevent causal or final-head performance
claims.
- Execution history: current focused 7/7, CLI and graph 2/2 completed on
their first attempt. The first final sealed attempt was interrupted by
an ignored disk monitor racing a disappearing rustc temporary file
(owned child -15), not a product test failure; supported recovery
preceded the complete PASS retry. Historical native fixture locator
failure and locale reproduction remain preserved, with their successful
corrected/valid-locale executions separately attributed.
- Scope choices: preserved screen-authoritative
read/delegated/request/physical-root/local-pet/duplicate-occurrence
policies; no Herdr API, persistence schema or dependency change.
Accepted main PRs supply the integration baseline.
- Evidence limits: historical request comparison uses different sidebar
tabs; reconstructed gallery/synthetic devices do not prove current OS
capture or live SSH. No installed-bundle, physical-phone/external-push,
whole local web E2E, fleet/deep-lineage, mutex or render/echo-latency
claim.
- Review report SHA256: Fidelity
`d708dde37f3cbc41fa579d1b40d40b7d313dec7f0e9515424de58c35184183db`; Code
`ac8acd56127be5fb63391eefdd84d3cdd6715ae843f12a57884cbebf18497512`.
- Delivery: one PR to `main`; explicit instruction “then ship PR and
CI.” overrides this worktree's absent PR-mode configuration without
editing it. Merge remains with the Observer.

- CI: [verify
run](https://github.com/modakbul-gongbang/hide/actions/runs/37696226091),
attempt 1, completed success at 2026-10-07T22:42:28Z; 17 successful jobs
and 2 configured skips, including the final required verify gate. Design
contract also passed. No GitHub rerun.
- CI test record: desktop E2E 61, Windows web E2E 36, Linux web E2E
shards 55+53+56+56=220; all 317 passed. All 12 native flaky-report steps
explicitly reported no flaky test; zero reported failed tests. Linux
workspace nextest 3,220 passed/16 skipped.
- Delivery image check: both public before/after images loaded in the
actual PR browser with complete=true and natural size 608×1800; the
checking page was closed.

</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