instar 1.3.1980 → 1.3.1981

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/commands/machine.d.ts.map +1 -1
  2. package/dist/commands/machine.js +5 -1
  3. package/dist/commands/machine.js.map +1 -1
  4. package/dist/commands/server.d.ts.map +1 -1
  5. package/dist/commands/server.js +9 -0
  6. package/dist/commands/server.js.map +1 -1
  7. package/dist/core/UpdateChecker.d.ts.map +1 -1
  8. package/dist/core/UpdateChecker.js +24 -0
  9. package/dist/core/UpdateChecker.js.map +1 -1
  10. package/dist/core/identityBuildFence.d.ts +97 -0
  11. package/dist/core/identityBuildFence.d.ts.map +1 -0
  12. package/dist/core/identityBuildFence.js +198 -0
  13. package/dist/core/identityBuildFence.js.map +1 -0
  14. package/dist/core/ownerRecordStore.d.ts +2 -0
  15. package/dist/core/ownerRecordStore.d.ts.map +1 -1
  16. package/dist/core/ownerRecordStore.js +2 -0
  17. package/dist/core/ownerRecordStore.js.map +1 -1
  18. package/dist/core/ownerRecordSync.d.ts +43 -1
  19. package/dist/core/ownerRecordSync.d.ts.map +1 -1
  20. package/dist/core/ownerRecordSync.js +115 -6
  21. package/dist/core/ownerRecordSync.js.map +1 -1
  22. package/dist/core/ownerRecordWiring.d.ts +19 -1
  23. package/dist/core/ownerRecordWiring.d.ts.map +1 -1
  24. package/dist/core/ownerRecordWiring.js +37 -2
  25. package/dist/core/ownerRecordWiring.js.map +1 -1
  26. package/dist/data/standards-guard-index.json +1 -1
  27. package/dist/data/standards-guard-index.meta.json +2 -2
  28. package/dist/data/standards-registry.meta.json +1 -1
  29. package/dist/monitoring/contextLayers/h3Builder.d.ts +1 -1
  30. package/dist/native/InstarWedgeCanary.app/Contents/MacOS/InstarWedgeCanary +0 -0
  31. package/dist/native/instar-desktop-host +0 -0
  32. package/dist/server/machineRoutes.d.ts.map +1 -1
  33. package/dist/server/machineRoutes.js +13 -0
  34. package/dist/server/machineRoutes.js.map +1 -1
  35. package/dist/server/ownerRecordRoutes.d.ts.map +1 -1
  36. package/dist/server/ownerRecordRoutes.js +2 -0
  37. package/dist/server/ownerRecordRoutes.js.map +1 -1
  38. package/dist/server/phoneSetupRoutes.d.ts.map +1 -1
  39. package/dist/server/phoneSetupRoutes.js +11 -0
  40. package/dist/server/phoneSetupRoutes.js.map +1 -1
  41. package/dist/server/sameNetworkListener.d.ts +39 -5
  42. package/dist/server/sameNetworkListener.d.ts.map +1 -1
  43. package/dist/server/sameNetworkListener.js +102 -16
  44. package/dist/server/sameNetworkListener.js.map +1 -1
  45. package/dist/server/sameNetworkRefusals.d.ts +59 -0
  46. package/dist/server/sameNetworkRefusals.d.ts.map +1 -0
  47. package/dist/server/sameNetworkRefusals.js +154 -0
  48. package/dist/server/sameNetworkRefusals.js.map +1 -0
  49. package/dist/testing/selfActionRegistry.d.ts.map +1 -1
  50. package/dist/testing/selfActionRegistry.js +27 -0
  51. package/dist/testing/selfActionRegistry.js.map +1 -1
  52. package/package.json +1 -1
  53. package/src/data/awareness/owner-record.md +1 -0
  54. package/src/data/awareness/same-network-first-phone.md +1 -0
  55. package/src/data/builtin-manifest.json +3 -3
  56. package/src/data/standards-guard-index.json +1 -1
  57. package/src/data/standards-guard-index.meta.json +2 -2
  58. package/src/data/standards-registry.meta.json +1 -1
  59. package/upgrades/1.3.1981.md +37 -0
  60. package/upgrades/side-effects/home-listener-phone-limits.md +59 -0
  61. package/upgrades/side-effects/identity-security-piece2c-minimum-build-fence.md +120 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instar",
3
- "version": "1.3.1980",
3
+ "version": "1.3.1981",
4
4
  "description": "Coherence infrastructure for self-evolving AI agents — on the Claude Code or Codex subscription you already have.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -4,4 +4,5 @@ title: Owner record on every machine
4
4
  Each of my machines keeps a signed owner record: which keys speak for the owner, which machines belong to me, and my security level. It is kept in step over signed mesh messages, and each machine checks every entry itself. Before saying anything about the owner's devices, my security level, or why a risky action is held, I read it: `curl -H "Authorization: Bearer $AUTH" http://localhost:{{port}}/owner-record`.
5
5
  - `gate.act` is `basic` (today's rules), `record` (the record decides) or `hold`. A hold refuses Sensitive and Serious actions but still allows viewing. `gate.enrolment` says whether the owner never enrolled, enrolled, or it is unknown.
6
6
  - `waitingOn` names a machine that hasn't answered. If it is gone for good, the administrator-prompt reset on this machine clears the hold.
7
+ - `fence` shows the minimum build once the owner has enrolled, and each machine's confirmed version. Before setting up a phone, every machine must be confirmed. A machine below it can't join, can't be rolled back to, and doesn't get the record. I tell the owner which machine to update or retire.
7
8
  - I never edit the record's files: they live in a protected folder and are rebuilt from my other machines.
@@ -6,4 +6,5 @@ When this agent has no Telegram owner and no address that works away from home (
6
6
  - The Instar app that created me on this computer does not need the PIN (nobody was told it): just before "Add your phone" it runs `instar mobile ceremony-credential --json` as my own user, inside my own system, and passes that one-time credential instead. It works once, for ten minutes, only from this computer, only for my first phone, and only where the number is typed at the computer. I never run it for a person: a person in a terminal uses `instar mobile add-phone` and the PIN.
7
7
  - Inside WSL the home address opens only when WSL's networking mode is read as NAT (`wslMode` in the status says what was read). In mirrored mode it stays closed (`held: wsl-networking-mode`) unless the Windows app said it enforces the network rule; unknown or other modes stay closed.
8
8
  - The home address uses port main + 20000 (for example 24040) unless one is already stored; the app may ask for another free port, and `preferredPort` in the status says which one the next open will use.
9
+ - Why a home phone was refused (a 403, a 404, a dropped connection, a TLS error): `curl -H "Authorization: Bearer $AUTH" http://localhost:{{port}}/mobile/same-network/refusals` lists the home listener's recent refusals, newest first: route, status, reason code, the first 8 characters of the phone's device id, the caller address and time (never a header value, body, signature or token). Read it before guessing why a phone said "Signed out" or could not connect. Behind the Windows app every entry's caller address is the app's own, so tell phones apart by the device id prefix; it keeps the latest 300 entries, so a flood can push older ones out.
9
10
  - **When to use**: the owner asks to add a phone and there is no tunnel, no Tailscale and no Telegram; or a home phone stopped working after the computer changed network (the owner allows the new network at the computer).
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "./builtin-manifest.schema.json",
3
3
  "schemaVersion": 1,
4
- "generatedAt": "2026-11-23T06:17:42.373Z",
5
- "instarVersion": "1.3.1980",
4
+ "generatedAt": "2026-11-23T06:35:55.896Z",
5
+ "instarVersion": "1.3.1981",
6
6
  "entryCount": 210,
7
7
  "entries": {
8
8
  "hook:session-start": {
@@ -796,7 +796,7 @@
796
796
  "type": "route-group",
797
797
  "domain": "coordination",
798
798
  "sourcePath": "src/server/machineRoutes.ts",
799
- "contentHash": "d8acdca46ba4e5a2ff21afec550bd79435b06e292a46f22c5ed8c27dbb877122",
799
+ "contentHash": "187ff6bbcf460e0ffd3581d94a9c8583eb62e3d4b98c32172d6b71b86807150a",
800
800
  "since": "2025-01-01"
801
801
  },
802
802
  "route-group:secret-drop": {
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "generatedFrom": "source-tree",
4
4
  "registrySha256": "11e2a45ab1345e2ded6499404ee9962e4e48bcfed4677a4d31dac4492565d2fa",
5
- "packageVersion": "1.3.1980",
5
+ "packageVersion": "1.3.1981",
6
6
  "guards": [
7
7
  {
8
8
  "ref": "docs/audits/phase-b/f10-triage.md",
@@ -1,5 +1,5 @@
1
1
  {
2
- "sha256": "f286225fad69021747c3c3c21be6b436a6a481fa98213913cdc4a55d0585cd0d",
2
+ "sha256": "fe22f36d1eab4269f94d71738087ed00cc170d7cd8d8063a24af5b124dae4bb9",
3
3
  "registrySha256": "11e2a45ab1345e2ded6499404ee9962e4e48bcfed4677a4d31dac4492565d2fa",
4
- "packageVersion": "1.3.1980"
4
+ "packageVersion": "1.3.1981"
5
5
  }
@@ -2,5 +2,5 @@
2
2
  "sha256": "11e2a45ab1345e2ded6499404ee9962e4e48bcfed4677a4d31dac4492565d2fa",
3
3
  "articleCount": 102,
4
4
  "generatedFrom": "docs/STANDARDS-REGISTRY.md",
5
- "packageVersion": "1.3.1980"
5
+ "packageVersion": "1.3.1981"
6
6
  }
@@ -0,0 +1,37 @@
1
+ # Upgrade Guide — vNEXT
2
+
3
+ <!-- assembled-by: assemble-next-md -->
4
+ <!-- bump: patch -->
5
+
6
+ ## What Changed
7
+
8
+ The same-network (home) listener's connection limits were sized below what a real phone does: a live iPhone pairing over home Wi-Fi (Windows-made test agent) showed one app screen opening about 8 TLS connections at once, and the 6-open / 40-a-minute per-address limit (32 in all) refused the rest (iOS TLS error -1200). The limits are now 24 open and 240 new a minute per address, 64 in all. In WSL mirrored mode every phone reaches the agent from the Windows pass-through's one loopback address, so that address now gets the whole door (64 open, 960 a minute); the pass-through limits each real phone itself. The home listener also keeps a bounded refusal log (`state/same-network-refusals.json`, at most 300 entries, repeats coalesced, written at most every 2 seconds, mode 0600): connections dropped by a limit, failed TLS handshakes, and every request answered with 400 or more, with route (ids replaced), status, reason code, device id prefix and caller address only. `GET /mobile/same-network/refusals` (bearer, from this computer only) reads it, newest first.
9
+
10
+ Groundwork for the identity and security plan. Each of your agent's computers now tells the others which version of Instar it runs, in a signed message. Nothing changes yet. Once you set up your phone to approve risky actions, a computer on an older version can't join, can't be rolled back to an older version, and doesn't get the ownership ledger. The agent tells you which computer to update.
11
+
12
+ ## What to Tell Your User
13
+
14
+ - **Your phone at home connects reliably**: "A phone added at home on the same Wi-Fi could be cut off when an app screen opened several connections at once. That limit now fits a real phone, and when I do turn a phone away I keep a short note of why, so I can tell you what happened."
15
+
16
+ - **Version check across your computers**: "Nothing changes for you now. Later, before you set up your phone for approvals, I'll make sure all your computers run a new enough version, and I'll tell you which one to update if not."
17
+
18
+ ## Summary of New Capabilities
19
+
20
+ | Capability | How to Use |
21
+ |-----------|-----------|
22
+ | Home listener limits sized for a real phone (24 open, 240 a minute per device; 64 in all) | Automatic |
23
+ | Why the home listener refused a phone: route, status, reason code, device id prefix | `GET /mobile/same-network/refusals` from the agent's computer |
24
+
25
+ | Capability | How to Use |
26
+ |-----------|-----------|
27
+ | Version fence status | `GET /owner-record` → `fence` |
28
+
29
+ ## Evidence
30
+
31
+ - `tests/unit/same-network-home-limits.test.ts`: both sides of every limit with the numbers themselves (24/25 open, 240/241 a minute with the 59 s and 60 s edges, the mirrored loopback door 64/65 and 960/961, another address in mirrored mode still 24), a busy phone of ten 12-connection loads a minute; the refusal log's route reduction, bound, coalescing, private file and restart; a real TLS listener records gate and route refusals, a limit refusal and a failed handshake once each. With the old 6/40/32 put back, 9 of its 19 tests fail (the limit tests).
32
+ - `tests/integration/same-network-refusals.test.ts`: over the real pipeline a stand-in phone's refused requests are recorded without the setup id, PIN, signature or full device id, and the route is bearer and this-computer only.
33
+ - `tests/e2e/same-network-first-phone-alive.test.ts`: the route answers on the production start path and the log survives a restart.
34
+
35
+ - Unit: `tests/unit/identity-piece2c-build-fence.test.ts`.
36
+ - Integration: `tests/integration/identity-piece2c-join-fence.test.ts`.
37
+ - E2E: `tests/e2e/identity-piece2b-owner-record-lifecycle.test.ts` (the build in every pull).
@@ -0,0 +1,59 @@
1
+ # Side effects: home listener limits sized for a real phone, and a bounded refusal log
2
+
3
+ In plain words: the agent's home (same-network) listener now lets a phone open as many connections as a real app screen does, gives the Windows pass-through's single address the whole door where every phone arrives through it, and writes a short, bounded note of every refusal so a phone's 403 or connection error can be explained afterwards.
4
+
5
+ Tier 1 (a revert fully undoes it; no config, no migration, no new authority). Size: 3 source files (`src/server/sameNetworkListener.ts`, new `src/server/sameNetworkRefusals.ts`, `src/server/phoneSetupRoutes.ts` one read route), 1 awareness line, 1 dated note in the A4 spec, 2 new test files, 2 test files extended. Effort: one build pass, one commit attempt planned.
6
+
7
+ Why now: builder #62 paired a real iPhone app over home Wi-Fi with a Windows-made test agent. Messages never got through. Through the Windows pass-through 8 parallel TLS connections went 6/8, straight to the agent 8/8; the app log showed "refused (limit)" exactly in the phone's failure windows. The pass-through is fixed in the Windows app (24/240/64 per address, same numbers); this change makes the agent's own limits agree.
8
+
9
+ Also in this change (it blocks it): main's `tests/unit/no-silent-fallbacks.test.ts` fails (495 > baseline 494) since #3603 added a designed probe catch in `src/core/UpdateChecker.ts` `findBundledNpmCli` (`catch { /* not this layout */ }`, line 820). Bisected on a clean main worktree: 494 two commits back, 495 from #3603. That catch now carries the `@silent-fallback-ok` marker with its reason (comment only, no behaviour change); the count is 494 again.
10
+
11
+ ## What changes for running agents
12
+ - `SAME_NETWORK_MAX_CONNECTIONS` 32 -> 64; `SAME_NETWORK_PER_ADDRESS_OPEN` 6 -> 24; `SAME_NETWORK_PER_ADDRESS_PER_MIN` 40 -> 240. Applies where the agent listens directly (macOS/Linux on the LAN address) and in WSL mirrored mode. WSL NAT mode is unchanged in shape: no per-address limit here (the pass-through owns it), the total is now 64, equal to the pass-through's total.
13
+ - WSL mirrored mode: the bind is loopback and every caller (the pass-through, carrying every phone) arrives as 127.0.0.1, so the old per-address bucket was one shared 6-place bucket for all phones (the spec itself noted "enough for one phone's setup"). That address (and its IPv4-mapped form) now gets `SAME_NETWORK_FORWARDER_OPEN` = 64 open and `SAME_NETWORK_FORWARDER_PER_MIN` = 960 a minute. Decided with the bind from the plan's mode, never from the caller. Any other address in mirrored mode keeps the per-phone limit. A direct (non-WSL) listener never gives loopback this bucket.
14
+ - New `SameNetworkRefusalLog`: records (a) a connection refused by a per-address limit (`address-open`, `address-per-minute`) or by the total (`total-open`, Node's `drop` event), (b) a failed TLS handshake (`tls-<code>`; a socket the listener itself closed for a limit is not recorded twice), (c) every request answered with status >= 400, by the gate or any route behind it, with the answer's own `error` code when it is a plain code (else `http-<status>`). Fields: time, kind, method, route (query dropped, id-like segments `:id`, odd characters `:x`, 120 chars max), status, first 8 characters of `X-Instar-Device` when it has an id's shape, caller's real address. Never a header value, body, query, signature, token, setup id or full device id. Bounded: 300 entries, an identical repeat of the newest only bumps its count; written as one JSON file (0600, atomic rename) at most once per 2 s and on stop; unreadable file starts empty; write errors keep entries in memory.
15
+ - `GET /mobile/same-network/refusals?limit=N` on the main listener, behind the existing `localOnly` (bearer + from this computer + no forwarding header + pairing on); not on the home listener (the gate only lets device-allowlisted routes through). Newest first, default 100, max 300.
16
+ - To read the answer's error code, the listener wraps `res.end` for that response only and keeps at most the first 512 characters of an error body in memory until the response finishes; nothing of it is stored except a matching plain code.
17
+
18
+ ## 1. Over-block
19
+ Fewer refusals than before. Remaining over-block: a household where more than 64 connections are open at once through one door, or one device opening more than 240 a minute (four a second sustained). Neither matches normal phone use (ten screen loads a minute is 120).
20
+
21
+ ## 2. Under-block
22
+ A misbehaving LAN device can now hold 24 sockets and open 4 a second instead of 6 and 40 a minute; the total 64, the 10 s handshake timeout and header/request timeouts still bound resources. In mirrored mode a local Windows program can use the whole 64 (it could already exhaust the old shared 6, starving every phone; a program already on the PC is outside the threat this limit addresses). The refusal log does not record successful requests (by design) nor refusals on the main listener.
23
+
24
+ Dependency named: the mirrored-mode door-sized bucket relies on the Windows pass-through limiting each real caller (24 open, 240 a minute). That is the Windows app's `LanForward` (instar-desktop-apps, commit raising its limits to 24/240/64, with tests on both sides of each limit in that repo); a Windows app older than that still refuses at 6/40 before the agent. How it is verified: the next live home-Wi-Fi phone run through the Windows app checks both hops with the refusal log and the app log.
25
+
26
+ ## 3. Level of abstraction
27
+ The limits stay where A4 put them (the listener's connection handler and the pass-through). The log sits in the listener, the one place that sees connection-level, TLS-level and HTTP-level refusals of that listener; routes are unchanged. No smarter gate exists for this; the log feeds people and agents, not a gate.
28
+
29
+ ## 4. Signal vs authority (docs/signal-vs-authority.md)
30
+ The log is a pure signal: it never refuses, delays or changes an answer. The limit change only moves existing numeric limits; the decision structure (deterministic resource bounds, not judgment calls) is unchanged, which is the right kind of logic for a resource bound.
31
+
32
+ ## 5. Interactions
33
+ - `markSameNetworkSocket` rewrites the socket's `remoteAddress` to `sn:<addr>`; the log takes the real address from that function's return value, so `isLoopbackPeer` and arrival checks are untouched.
34
+ - Wrapping `res.end` calls the original with the same arguments; the gate's bare `/health` answer, `writeContinue` and express responses behave as before (existing integration/e2e suites pass).
35
+ - The Windows pass-through ships 24/240/64 in the same change set (separate repo), so the two hops agree; an older Windows app with 6/40/32 still refuses before the agent and is fixed by its own update.
36
+ - The wsl-listener test "per-address limit stays on in mirrored mode" now asserts the door-sized bucket.
37
+
38
+ ## 6. External surfaces
39
+ One new local-only read route; a new state file in the agent's state folder (not synced). Phones see fewer refusals. No change to what the listener serves.
40
+
41
+ ## 7. Multi-machine posture
42
+ Machine-local by design: each machine's home listener serves only phones on that machine's network, and its refusals are about that machine's door. The file is in `state/` and is not part of git-sync; reading another machine's refusals goes through that machine (not proxied), which matches the other `/mobile/same-network*` routes.
43
+
44
+ ## 8. Rollback
45
+ Revert the commit. The state file is left behind harmlessly (nothing reads it after a revert); no migration.
46
+
47
+ ## Tests
48
+ - `tests/unit/same-network-home-limits.test.ts` (new, 19): the literal numbers; a busy phone (ten 12-connection loads in a minute, then 24 open); 24/25 open and 240/241 a minute with the 59 s/60 s edges; mirrored loopback 64/65 and 960/961, IPv4-mapped form, two busy phones, another address still 24, a direct listener's loopback still 24; refusal-log route reduction, codes, device prefix, bound and coalescing, private file and restart, unreadable file; a real TLS listener records gate and route refusals (no secrets in the file), a limit refusal and a failed handshake once each. Negative control: with 6/40/32 put back, 9 of 19 fail (the limit tests; the log tests do not depend on the numbers).
49
+ - `tests/integration/same-network-refusals.test.ts` (new, 2): a stand-in phone over real TLS; refusals read back through the route without setup id, PIN, signature, pairing code or full device id; 401 without a token, 403 when forwarded.
50
+ - `tests/e2e/same-network-first-phone-alive.test.ts`: the route is alive on the production start path, and the log survives a restart.
51
+ - `tests/unit/same-network-wsl-listener.test.ts`: mirrored bucket assertion updated.
52
+
53
+ ## Second-pass review
54
+
55
+ **Reviewer:** independent reviewer subagent (general-purpose, fresh context, given the diff, the artifact and the A4 spec), 2026-11-21. Verdict: concur, nothing blocking. It traced that the forwarder bucket is set only from a mirrored bind plan (always 127.0.0.1) and never in NAT, direct or test-override binds; that nothing secret is kept and a flood writes at most once per 2 s; that the `res.end` wrap passes everything through and records once; and that the route is reachable only with the bearer from this computer (the home listener's gate answers 404 first). Non-blocking findings, handled: an error body over 512 characters lost its code (a leading `"error"` field is now read without a full parse); a request whose connection closed before any answer went unrecorded (now `closed-before-answer`); the caller address cannot tell phones apart behind the pass-through and a flood can push old entries out (said in the awareness text); the pass-through dependency is named above. Accepted: a short all-letter token-like path segment would be kept as written (no current home-listener route carries one). Test gaps closed: NAT never gets the door-sized bucket, a burst writes the file once, a clipped error body keeps its code, a hung-up request is recorded.
56
+
57
+ ## Current-main repair, 2026-11-22
58
+
59
+ Fresh helper-created worktree based on JKHeadley/main 9b61d6286, version 1.3.1978. The only merge conflict was two equivalent explanatory comments on UpdateChecker.findBundledNpmCli; retained current main verbatim. No runtime source differs from the previously reviewed candidate except the already-current main. All eight side-effects answers above remain unchanged. Targeted validation: 35 unit, 2 HTTP integration, and 3 production lifecycle tests pass; TypeScript noEmit passes. Full current-tree verification is required before merge. Independent reviewer /root/review_3625_repair concurred: listener, log, route and tests byte-for-byte unchanged from c3f9c466; local-only authentication and forwarder bounds intact. One repair review, one commit attempt planned.
@@ -0,0 +1,120 @@
1
+ # Side-Effects Review — The minimum-build fence
2
+
3
+ **Version / slug:** `identity-security-piece2c-minimum-build-fence`
4
+ **Date:** `2026-11-18`
5
+ **Author:** `Echo`
6
+ **Second-pass reviewer:** `independent reviewer subagent (see below)`
7
+
8
+ ## Summary of the change
9
+
10
+ Piece 2c of the approved identity and security design (topic 144636): machines too old to follow the identity rules are waited for before enrolment, then refused after it.
11
+
12
+ - `src/core/identityBuildFence.ts` contains:
13
+ - the per-level floor table (Basic has no fence);
14
+ - `PeerBuildLedger`: each peer's signed build statement, per registration, saved under the key-material path `state/owner-record/`, with four states (confirmed, below, unconfirmed, retired);
15
+ - `fenceInForce`: the record's `minimumBuild` or the last verified fence; a bad value never relaxes it; an owner's lowering to Basic clears it;
16
+ - `fenceStatus` (readiness) and `belowFence`.
17
+ - `ownerRecordSync.ts`:
18
+ - pulls carry `build` and `guards`, and replies carry the replier's build and guards, recorded before judging;
19
+ - after enrolment, only confirmed peers get or give owner-record data;
20
+ - one aggregated notice from the lease holder, at most daily;
21
+ - a `fence` section in status.
22
+ - `ownerRecordStore.gate()` holds with `fence-unusable` when enrolled with no usable fence.
23
+ - `machineRoutes.ts` (`POST /api/pair`) refuses a joiner below the fence after enrolment. The joiner (`commands/machine.ts`) now sends its build.
24
+ - `UpdateChecker.rollback()` refuses a rollback below the fence.
25
+ - `ownerRecordWiring.ts` adds `ownerRecordGate()` (piece 2b's one gate function, now exported for later pieces) and `ownerRecordFence()`, and wires the ledger, build and notice. `server.ts` passes the notice through `notify('SUMMARY', 'mesh-alert', …)`.
26
+ - The route `GET /owner-record` gains `fence`, and the awareness entry gains a line.
27
+
28
+ ## Decision-point inventory
29
+
30
+ - **Sharing the owner record while enrolled:** confirmed peers only.
31
+ - **A join after enrolment:** refused below the fence.
32
+ - **A rollback after enrolment:** refused below the fence.
33
+ - **The gate:** holds when enrolled with no usable fence.
34
+
35
+ ## 1. Over-block
36
+
37
+ - **Before enrolment nothing is refused,** and no agent is enrolled until piece 3.
38
+ - **After enrolment, missing evidence refuses nothing except the record itself.** A sleeping or restarting peer reads "unconfirmed": it gets no record entries until it pulls again, but liveness, lease and work traffic are untouched.
39
+ - **A join at or above the fence pairs normally.**
40
+
41
+ ## 2. Under-block
42
+
43
+ A hand-installed older build still acts on its own direct inbound. That is the stated residual. Refusing it the lease and routing is piece 2d, and Phone-level enrolment waits for 2d.
44
+
45
+ ## 3. Level-of-abstraction fit
46
+
47
+ - **The fence lives beside the owner record.**
48
+ - **Join and rollback refusals sit at their existing choke points:** the join route, and `UpdateChecker.rollback`, next to the existing Codex downgrade floor.
49
+
50
+ ## 4. Signal vs authority compliance
51
+
52
+ **Required reference:** [docs/signal-vs-authority.md](../../docs/signal-vs-authority.md)
53
+
54
+ - [ ] No — this change produces a signal consumed by an existing smart gate.
55
+ - [x] No — the decisions are deterministic comparisons over enumerable inputs (version strings, signed statements, enrolment state); no judgment over meaning.
56
+ - [ ] Yes — but the logic is a smart gate with full conversational context.
57
+ - [ ] ⚠️ Yes, with brittle logic — STOP.
58
+
59
+ ## 4b. Judgment-point check
60
+
61
+ The 24-hour freshness window is four full backoff cycles of a pulling peer (spec §2). The notice is at most daily per unchanged list.
62
+
63
+ ## 5. Interactions
64
+
65
+ - **Pulls gain two fields,** and older builds ignore unknown fields.
66
+ - **The join body gains `instarVersion`;** an older inviter ignores it.
67
+ - **Rollback** gains one more refusal, beside the existing Codex floor.
68
+
69
+ ## 6. Rollback
70
+
71
+ Revert the commit. The ledger file can stay; nothing else reads it.
72
+
73
+ ## 7. Evidence
74
+
75
+ - **Unit:** `tests/unit/identity-piece2c-build-fence.test.ts` covers:
76
+ - the ledger's states, ordering, restart and per-key observations;
77
+ - the fence in force, including a bad value and lowering;
78
+ - readiness;
79
+ - `belowFence`;
80
+ - sync refusal only after enrolment;
81
+ - the single notice and the status;
82
+ - rollback refusal.
83
+ - **Integration:** `tests/integration/identity-piece2c-join-fence.test.ts`, run by Local Verify, covers a join before enrolment, a refused join (no build and an older build), and an accepted join.
84
+ - **E2E lifecycle:** the 2b lifecycle file gains one case: the production sync sends its build in every pull, and the route reports `fence`.
85
+
86
+ ## Second-pass review
87
+
88
+ An independent reviewer subagent read the code against the spec and probed it over three rounds. All 11 defects it found are fixed, each with a regression test:
89
+ - **Round 1 (8):**
90
+ - a lost or contested record relaxed or lowered the fence;
91
+ - unsigned reply builds counted as evidence, stamped with mixed clocks;
92
+ - the notice was filtered out by the hub;
93
+ - a new machine was reported as silent "for a day";
94
+ - this machine was left out of readiness;
95
+ - no report of a bad value;
96
+ - explicit installs were not fenced;
97
+ - the joiner hid the server's message.
98
+ - **Round 2 (2, plus 1 partial):**
99
+ - an unusable fence refused the owner's correction;
100
+ - a raise was never reported;
101
+ - a pairing-time judgement was still needed for new machines.
102
+ - **Round 3 (1):** a development install was compared against the installer's version instead of the agent's.
103
+
104
+ Round 4 concurred. Review: `.instar/state/identity-build-144636/reviews/p2c-second-pass.md` in the agent home.
105
+
106
+ E2E-PAIRING: EXEMPT — the join refusal is covered by the integration test over the real /api/pair route; no device pairing flow changes.
107
+
108
+ ## Class-Closure Declaration
109
+
110
+ - **defectClass:** `unbounded-self-action`
111
+ - **closure:** `guard` (tests/unit/self-action-convergence.test.ts, entry owner-record-fence-notice)
112
+ - **reason:** the only self-triggered action is the aggregated notice: once per distinct list (never repeated for an unchanged one), from the lease holder only, closed when the list empties; registered in the self-action registry.
113
+
114
+ ## Current-main merge repair, 2026-11-22
115
+
116
+ Tier 2 security maintenance under the existing approved spec; no new authority or policy. The normal merge from main 9b61d628656b5782e39c0ad57d6fb108b8ad3ad7 retains both new server imports. Semantic review found that the earlier merge had removed the unrelated stall-reconfirmation feature. Its source, types, tests, awareness and review artifacts are restored exactly from current main, including the server wiring. No paths are deleted relative to main. The minimum-build fence additions remain intact.
117
+
118
+ The independent parent reviewer inspected the actual candidate and concurred: the restored feature is byte-identical to main, and server initialization retains both the stall guard and fence wiring. No material merge concern remained, conditional on verification. Focused verification passed: 89 unit tests in five files, eight HTTP integration tests in two files, and TypeScript checking. Full verification remains assigned to the throughput coordinator. Dependency order 3445 then 3450 then 3453 and all queue holds remain unchanged.
119
+
120
+ The rollback is a normal revert of this merge repair, with the known cost that the prior branch accidentally omitted a main safety feature. There is no new persistence format, cross-machine behavior, external authority, or enrollment behavior in the repair. Existing signal-versus-authority analysis above continues to apply. One independent review pass and one commit attempt planned; no new design review rounds.