Repository navigation
CONTRACT: feat(ui-server, ui-react): review a sync's incoming governance policy instead of failing (#4256) - #4266
Conversation
…stead of failing (#4256) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cs, decision and tests (#4256) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rt (#4256) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No uploads on this PR yet This PR changes UI files (
Tips for agentsLabel each shot so reviewers know what they're seeing. Labels apply to every file in a call, so run one uploads put after.png --pr 4266 --meta path=/settings --state after --caption "Saved settings toast"
uploads put chat.png --pr 4266 --app ios --screen "Chat" --state afterNo CLI? With the Uploads MCP, call This comment updates with each upload, so you don't need to post the images yourself. A shot or two in the PR description is still welcome. Check what's attached with Workspace admins can turn this comment off in Settings → GitHub · docs |
Independent reviewReviewed head 426177a against base cb42362. Reviewer: agent. 6 findings: 0 fixed, 0 filed, 0 rejected, 6 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "426177a545398cf0011f19d152bd34c6b1c4c75c",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-sdk/src/server/worker-native-output.ts:435 with packages/ui-server/src/brain/sync-mirror.ts:163: if the brain has no context/policies/ dir, the pull also creates that dir, a stage entry inside tier A (isWithin includes the root), so refused is [context/policies, context/policies/governance.md]. paths.length===1 fails, the first-policy case gets the generic refusal and no review, and tests/sync-mirror.test.ts:157 (corpus has no context/policies) should go red."
},
{
"summary": "packages/ui-server/src/routes/brain.ts:388: failure is set from the non-zero exit before the policy_review branch, so run.end at :418 records the paused UI sync's activity run as failed and logs 'ui sync failed'. The issue asks for a distinct 'waiting for policy review' outcome, not a failure. The done frame says success:false too, and no test checks the recorded run outcome."
},
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:217: the no-remote local sync also passes onPolicyChange though nothing is pulled, so a governance.md change there can only come from the worker's own repository code. The host still opens a review whose fixed rationale (routes/brain.ts:151) says 'Incoming from the brain's remote'. On the remote path the bytes are also worker output, never checked against the named upstream commit's blob. Workers must not be a source of policy changes."
},
{
"summary": "packages/ui-server/tests/sync-policy-review.test.ts:123: the approval test stubs the journal and recordEvent, then only parses the written file (:126). It never asserts journal class 'policy', a policy_change governance event through the app's activity.governanceWrites wiring, or that the next admitted turn's frozen policy admits outward.github.repositories, all of which the acceptance criteria require a test to assert."
},
{
"summary": "packages/ui-server/tests/sync-mirror.test.ts:162: the 'next sync completes' step writes the adopted bytes with writeFileSync rather than approving through the policy writer. No test chains a real approval through createPolicyProposals into a following hosted sync completing, which the acceptance criterion 'A following sync completes' asks for after an approval."
},
{
"summary": "docs/decisions/governed-writable-workers.md:856: the new ruling blockquote is inserted mid-paragraph with no blank line after it, so the existing text 'Within one server process, maintenance clients serialize...' (:857) becomes a lazy continuation inside the 2026-11-20 ruling quote. That misattributes an earlier rule to this ruling in the decision record."
}
]
} |
…oo; a paused sync is not a failure (#4256) The incoming bytes must equal the upstream commit's policy blob, read by the host transport, so worker output is never a policy source; a sync without a remote reviews nothing. A first policy, whose pull also creates context/policies, is reviewable. A paused UI sync's Activity run ends as cancelled with its reason, not as a failure. Tests now approve through the real policy writer and, end to end through createApp, assert the journal, the governance event and the next turn's policy facts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent reviewReviewed head 426177a against base cb42362. Reviewer: agent. 6 findings: 6 fixed, 0 filed, 0 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "426177a545398cf0011f19d152bd34c6b1c4c75c",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-sdk/src/server/worker-native-output.ts:435 with packages/ui-server/src/brain/sync-mirror.ts:163: if the brain has no context/policies/ dir, the pull also creates that dir, a stage entry inside tier A (isWithin includes the root), so refused is [context/policies, context/policies/governance.md]. paths.length===1 fails, the first-policy case gets the generic refusal and no review, and tests/sync-mirror.test.ts:157 (corpus has no context/policies) should go red.",
"disposition": "fixed",
"commit": "f3320cf09fe13077007274a8c295b173915fd6a9"
},
{
"summary": "packages/ui-server/src/routes/brain.ts:388: failure is set from the non-zero exit before the policy_review branch, so run.end at :418 records the paused UI sync's activity run as failed and logs 'ui sync failed'. The issue asks for a distinct 'waiting for policy review' outcome, not a failure. The done frame says success:false too, and no test checks the recorded run outcome.",
"disposition": "fixed",
"commit": "f3320cf09fe13077007274a8c295b173915fd6a9"
},
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:217: the no-remote local sync also passes onPolicyChange though nothing is pulled, so a governance.md change there can only come from the worker's own repository code. The host still opens a review whose fixed rationale (routes/brain.ts:151) says 'Incoming from the brain's remote'. On the remote path the bytes are also worker output, never checked against the named upstream commit's blob. Workers must not be a source of policy changes.",
"disposition": "fixed",
"commit": "f3320cf09fe13077007274a8c295b173915fd6a9"
},
{
"summary": "packages/ui-server/tests/sync-policy-review.test.ts:123: the approval test stubs the journal and recordEvent, then only parses the written file (:126). It never asserts journal class 'policy', a policy_change governance event through the app's activity.governanceWrites wiring, or that the next admitted turn's frozen policy admits outward.github.repositories, all of which the acceptance criteria require a test to assert.",
"disposition": "fixed",
"commit": "f3320cf09fe13077007274a8c295b173915fd6a9"
},
{
"summary": "packages/ui-server/tests/sync-mirror.test.ts:162: the 'next sync completes' step writes the adopted bytes with writeFileSync rather than approving through the policy writer. No test chains a real approval through createPolicyProposals into a following hosted sync completing, which the acceptance criterion 'A following sync completes' asks for after an approval.",
"disposition": "fixed",
"commit": "f3320cf09fe13077007274a8c295b173915fd6a9"
},
{
"summary": "docs/decisions/governed-writable-workers.md:856: the new ruling blockquote is inserted mid-paragraph with no blank line after it, so the existing text 'Within one server process, maintenance clients serialize...' (:857) becomes a lazy continuation inside the 2026-11-20 ruling quote. That misattributes an earlier rule to this ruling in the decision record.",
"disposition": "fixed",
"commit": "f3320cf09fe13077007274a8c295b173915fd6a9"
}
]
} |
…4256) The determinism job repeats a changed file in one process; its module-body DOM registration ran once, so the second run had no window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he same typed error (#4256) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…readable covered file Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent reviewReviewed head 551f333 against base cb42362. Reviewer: agent. 3 findings: 0 fixed, 0 filed, 0 rejected, 3 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "551f333f7c8fabf172417cae48955205505f25d6",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:251: verify() runs git cat-file in the mirror after the worker ran, but the worker can write mirror objects/ and refs/ (:257). The transport sets no GIT_NO_REPLACE_OBJECTS and runs no fsck in between, so repository code can add refs/replace/<upstream sha> or overwrite a loose object and pass its own bytes as the upstream blob, breaking 'worker output is never a policy source'."
},
{
"summary": "packages/ui-server/tests/sync-mirror.test.ts:132 and tests/sync-policy-app.test.ts:66: the issue requires the fixture-corpus integration test to be shown failing on the tree before the change, but the PR body records no failing-first receipt for either test. It lists only mutation receipts and says the native sync-mirror tests never ran locally."
},
{
"summary": "packages/ui-sdk/src/server/worker-native-output.ts:435 and packages/ui-server/src/brain/sync-mirror.ts:680: the PR changes an integrity guard (the tier A refusal now exposes refused bytes, and the host turns it into a paused sync and a review), but the PR body does not answer the checklist in docs/decisions/proportionate-containment.md that AGENTS.md requires for a changed guard."
}
]
} |
… without replace objects (#4256) A sync worker can write the mirror's objects and refs, so the blob it is compared with is now read after the integrity check and fetch and before the worker, and every transport runs with GIT_NO_REPLACE_OBJECTS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nPolicyChange, as before #4256 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent reviewReviewed head 551f333 against base cb42362. Reviewer: agent. 3 findings: 2 fixed, 0 filed, 1 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "551f333f7c8fabf172417cae48955205505f25d6",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:251: verify() runs git cat-file in the mirror after the worker ran, but the worker can write mirror objects/ and refs/ (:257). The transport sets no GIT_NO_REPLACE_OBJECTS and runs no fsck in between, so repository code can add refs/replace/<upstream sha> or overwrite a loose object and pass its own bytes as the upstream blob, breaking 'worker output is never a policy source'.",
"disposition": "fixed",
"commit": "02d944745a58b0d35e053ce85cc13e6797d9b6b9"
},
{
"summary": "packages/ui-server/tests/sync-mirror.test.ts:132 and tests/sync-policy-app.test.ts:66: the issue requires the fixture-corpus integration test to be shown failing on the tree before the change, but the PR body records no failing-first receipt for either test. It lists only mutation receipts and says the native sync-mirror tests never ran locally.",
"disposition": "fixed",
"commit": "34ecb7ed45464e35b571451f27a3943335294597"
},
{
"summary": "packages/ui-sdk/src/server/worker-native-output.ts:435 and packages/ui-server/src/brain/sync-mirror.ts:680: the PR changes an integrity guard (the tier A refusal now exposes refused bytes, and the host turns it into a paused sync and a review), but the PR body does not answer the checklist in docs/decisions/proportionate-containment.md that AGENTS.md requires for a changed guard.",
"disposition": "rejected",
"reason": "Not a code defect: the PR body now answers the proportionate-containment checklist in its Guard checklist section; no code change is needed."
}
]
} |
Independent reviewReviewed head 551f333 against base cb42362. Reviewer: agent. 3 findings: 2 fixed, 0 filed, 1 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "551f333f7c8fabf172417cae48955205505f25d6",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:251: verify() runs git cat-file in the mirror after the worker ran, but the worker can write mirror objects/ and refs/ (:257). The transport sets no GIT_NO_REPLACE_OBJECTS and runs no fsck in between, so repository code can add refs/replace/<upstream sha> or overwrite a loose object and pass its own bytes as the upstream blob, breaking 'worker output is never a policy source'.",
"disposition": "fixed",
"commit": "02d944745a58b0d35e053ce85cc13e6797d9b6b9"
},
{
"summary": "packages/ui-server/tests/sync-mirror.test.ts:132 and tests/sync-policy-app.test.ts:66: the issue requires the fixture-corpus integration test to be shown failing on the tree before the change, but the PR body records no failing-first receipt for either test. It lists only mutation receipts and says the native sync-mirror tests never ran locally.",
"disposition": "fixed",
"commit": "bb3d16c42844d11f64a32b157701ab3c2931dfd2"
},
{
"summary": "packages/ui-sdk/src/server/worker-native-output.ts:435 and packages/ui-server/src/brain/sync-mirror.ts:680: the PR changes an integrity guard (the tier A refusal now exposes refused bytes, and the host turns it into a paused sync and a review), but the PR body does not answer the checklist in docs/decisions/proportionate-containment.md that AGENTS.md requires for a changed guard.",
"disposition": "rejected",
"reason": "Not a code defect: the PR body now answers the proportionate-containment checklist in its Guard checklist section; no code change is needed."
}
]
} |
Independent reviewReviewed head bb3d16c against base cb42362. Reviewer: agent. 3 findings: 0 fixed, 0 filed, 0 rejected, 3 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "bb3d16c42844d11f64a32b157701ab3c2931dfd2",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-react/src/components/quick-actions/streaming-modal.tsx:101: the paused sync's done frame (success:false, reason:\"policy_review\") goes to setState(\"error\"), so the sync panel's badge reads \"Failed\". The issue requires a distinct 'waiting for policy review' outcome, not a failure. The server records it as cancelled, but the owner sees Failed, and slide-panel.test.tsx (StreamingPanel sync policy review) never checks the panel state."
},
{
"summary": "packages/ui-server/src/brain/owner-policy-reviews.ts:76 with routes/brain.ts:398: each UI sync opens a new pending review. An unanswered one (panel closed, or a failed decide POST whose UI says 'Sync again') stays pending for 10 min. After 4 of these, propose throws busy and the next sync fails with 'Answer the open policy reviews first', for reviews the UI can no longer show. This breaks 'a following sync opens the review again rather than failing'."
},
{
"summary": "docs/decisions/governed-writable-workers.md:844-845: the new ruling says that when 'the only refused path is governance.md' the host 'reads the output's bytes' and reviews them. The code (sync-mirror.ts:170) also accepts the context/policies directory, and reviews only bytes equal to the upstream commit's blob read before the worker runs, refusing any other bytes. The record leaves out that upstream-blob rule, which is what keeps worker output from ever being a policy source."
}
]
} |
…reviews replace stale ones; state the blob rule (#4256) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent reviewReviewed head d751b95 against base cb42362. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "d751b95f77f4fbe8458ac71394f087ea06b1a523",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:181 with :252: a scheduled sync never reads the upstream blob (onPolicyChange absent), so it tells the owner to 'Run Sync in the app to review it' even when the merged governance.md differs from the upstream commit's (e.g. a clean 3-way merge with a local policy edit). The UI sync then refuses that same change as unreviewable at :177, so the scheduled refusal names a review that will never open."
}
]
} |
…fore naming a review (#4256) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent reviewReviewed head d751b95 against base cb42362. Reviewer: agent. 1 finding: 1 fixed, 0 filed, 0 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "d751b95f77f4fbe8458ac71394f087ea06b1a523",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:181 with :252: a scheduled sync never reads the upstream blob (onPolicyChange absent), so it tells the owner to 'Run Sync in the app to review it' even when the merged governance.md differs from the upstream commit's (e.g. a clean 3-way merge with a local policy edit). The UI sync then refuses that same change as unreviewable at :177, so the scheduled refusal names a review that will never open.",
"disposition": "fixed",
"commit": "f92b99db1b587dac16fefdd38ffdbc9b1daa91e3"
}
]
} |
Independent reviewReviewed head f92b99d against base cb42362. Reviewer: agent. 2 findings: 0 fixed, 0 filed, 0 rejected, 2 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "f92b99db1b587dac16fefdd38ffdbc9b1daa91e3",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:254: every remote sync now reads the upstream governance.md blob with git cat-file through transport(), which sets no outputBytes bound (runMaintenanceWorker defaults to Infinity), while the stage read is capped at INCOMING_POLICY_READ_BOUND. An upstream commit with a very large governance.md is buffered whole into host memory on each sync attempt, even a scheduled one, before the 1 MiB writer bound can refuse it by name."
},
{
"summary": "packages/ui-react/src/components/quick-actions/streaming-modal.tsx:161: SyncPolicyReview is rendered as a sibling after StreamingOutput, whose root is 'flex h-full flex-col' filling the drawer's flex-1 overflow-y-auto box, so the Approve/Decline card starts below the log and its Close footer, out of view until the owner scrolls the outer container; the happy-dom test (slide-panel.test.tsx) cannot see layout."
}
]
} |
…view inside the panel's scroll area (#4256) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent reviewReviewed head f92b99d against base cb42362. Reviewer: agent. 2 findings: 2 fixed, 0 filed, 0 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "f92b99db1b587dac16fefdd38ffdbc9b1daa91e3",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:254: every remote sync now reads the upstream governance.md blob with git cat-file through transport(), which sets no outputBytes bound (runMaintenanceWorker defaults to Infinity), while the stage read is capped at INCOMING_POLICY_READ_BOUND. An upstream commit with a very large governance.md is buffered whole into host memory on each sync attempt, even a scheduled one, before the 1 MiB writer bound can refuse it by name.",
"disposition": "fixed",
"commit": "c425cd8a85b7c25b3dc1a0ff6aaf80e7b2b16e5a"
},
{
"summary": "packages/ui-react/src/components/quick-actions/streaming-modal.tsx:161: SyncPolicyReview is rendered as a sibling after StreamingOutput, whose root is 'flex h-full flex-col' filling the drawer's flex-1 overflow-y-auto box, so the Approve/Decline card starts below the log and its Close footer, out of view until the owner scrolls the outer container; the happy-dom test (slide-panel.test.tsx) cannot see layout.",
"disposition": "fixed",
"commit": "c425cd8a85b7c25b3dc1a0ff6aaf80e7b2b16e5a"
}
]
} |
Independent reviewReviewed head c425cd8 against base cb42362. Reviewer: agent. 2 findings: 0 fixed, 0 filed, 0 rejected, 2 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "c425cd8a85b7c25b3dc1a0ff6aaf80e7b2b16e5a",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:173: protectedRefusal reads the stage policy with INCOMING_POLICY_READ_BOUND before any check. readRefused (worker-native-output.ts:69) throws for a larger file, and nothing catches it. An upstream governance.md over 1 MiB+1 fails UI and scheduled syncs with a bare 'Refused output ... exceeds 1048577 bytes'. That drops the tier A refusal and its next-step text, and contradicts the :145 comment that the writer refuses it by name."
},
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:186: every other refused tier A change says 'revert the upstream commit that makes it'. That includes a no-remote sync (:228), where nothing is pulled, and a remote sync where the sync's own repository code wrote the file (e.g. bunfig.toml). In both cases no upstream commit makes the change, so the next-step text the issue requires points the owner at a commit that does not exist."
}
]
} |
Independent reviewReviewed head c425cd8 against base cb42362. Reviewer: agent. 2 findings: 2 fixed, 0 filed, 0 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "c425cd8a85b7c25b3dc1a0ff6aaf80e7b2b16e5a",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:173: protectedRefusal reads the stage policy with INCOMING_POLICY_READ_BOUND before any check. readRefused (worker-native-output.ts:69) throws for a larger file, and nothing catches it. An upstream governance.md over 1 MiB+1 fails UI and scheduled syncs with a bare 'Refused output ... exceeds 1048577 bytes'. That drops the tier A refusal and its next-step text, and contradicts the :145 comment that the writer refuses it by name.",
"disposition": "fixed",
"commit": "d197e3377c49f79a53160feb89fa04886214df4b"
},
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:186: every other refused tier A change says 'revert the upstream commit that makes it'. That includes a no-remote sync (:228), where nothing is pulled, and a remote sync where the sync's own repository code wrote the file (e.g. bunfig.toml). In both cases no upstream commit makes the change, so the next-step text the issue requires points the owner at a commit that does not exist.",
"disposition": "fixed",
"commit": "d197e3377c49f79a53160feb89fa04886214df4b"
}
]
} |
Independent reviewReviewed head d197e33 against base cb42362. Reviewer: agent. 3 findings: 0 fixed, 0 filed, 0 rejected, 3 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "d197e3377c49f79a53160feb89fa04886214df4b",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "docs/http-api.md:665: the new 'Incoming policy change (additive, #4256)' paragraph was inserted mid-paragraph, so the existing sentences 'Successful sync attempts voice keyterm rebuild; a rebuild failure is progress text...' and the following ones about degraded rebuilds and the 500 now continue inside the #4256 paragraph. That attributes general sync rules to this additive change in the HTTP reference that the contract index links to."
},
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:567: verify only checks that the stage bytes equal the upstream commit's governance.md blob, not that the pull changed the policy relative to the brain's pre-sync copy. Repository code in the sync worker can rewrite a locally adopted policy back to upstream's older blob. The host then opens a review whose fixed rationale (routes/brain.ts:726) says 'the pull changes' the policy, so worker output becomes a policy-change source."
},
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:548: refusedSync rewrites only JSON stdout and keeps the human-mode report. The UI sync runs 'sync --human' (routes/brain.ts:315), so the panel and the Activity job_output now stream the CLI's own report (committed and pushed to the mirror) before the paused or refused text, although nothing was published or pushed. Before this change the thrown refusal dropped stdout (host-boundary.ts:740)."
}
]
} |
Independent reviewReviewed head d197e33 against base cb42362. Reviewer: agent. 3 findings: 3 fixed, 0 filed, 0 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "d197e3377c49f79a53160feb89fa04886214df4b",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "docs/http-api.md:665: the new 'Incoming policy change (additive, #4256)' paragraph was inserted mid-paragraph, so the existing sentences 'Successful sync attempts voice keyterm rebuild; a rebuild failure is progress text...' and the following ones about degraded rebuilds and the 500 now continue inside the #4256 paragraph. That attributes general sync rules to this additive change in the HTTP reference that the contract index links to.",
"disposition": "fixed",
"commit": "cbf48210a13b43d00993dac9d930e0291beefd7c"
},
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:567: verify only checks that the stage bytes equal the upstream commit's governance.md blob, not that the pull changed the policy relative to the brain's pre-sync copy. Repository code in the sync worker can rewrite a locally adopted policy back to upstream's older blob. The host then opens a review whose fixed rationale (routes/brain.ts:726) says 'the pull changes' the policy, so worker output becomes a policy-change source.",
"disposition": "fixed",
"commit": "cbf48210a13b43d00993dac9d930e0291beefd7c"
},
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:548: refusedSync rewrites only JSON stdout and keeps the human-mode report. The UI sync runs 'sync --human' (routes/brain.ts:315), so the panel and the Activity job_output now stream the CLI's own report (committed and pushed to the mirror) before the paused or refused text, although nothing was published or pushed. Before this change the thrown refusal dropped stdout (host-boundary.ts:740).",
"disposition": "fixed",
"commit": "cbf48210a13b43d00993dac9d930e0291beefd7c"
}
]
} |
Independent reviewReviewed head cbf4821 against base cb42362. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "cbf48210a13b43d00993dac9d930e0291beefd7c",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:658: verify decodes the stage policy with fatal UTF-8 and refuses on failure, so a non-UTF-8 upstream governance.md equal to the stage is refused as \"differs from the upstream commit's ... change the policy upstream so the brain's copy matches it\", wrong next-step text. The UTF-8 branch in routes/brain.ts:734 is unreachable, contradicting docs/http-api.md (not UTF-8 opens no review, progress names the next step)."
}
]
} |
Independent reviewReviewed head cbf4821 against base cb42362. Reviewer: agent. 1 finding: 1 fixed, 0 filed, 0 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "cbf48210a13b43d00993dac9d930e0291beefd7c",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:658: verify decodes the stage policy with fatal UTF-8 and refuses on failure, so a non-UTF-8 upstream governance.md equal to the stage is refused as \"differs from the upstream commit's ... change the policy upstream so the brain's copy matches it\", wrong next-step text. The UTF-8 branch in routes/brain.ts:734 is unreachable, contradicting docs/http-api.md (not UTF-8 opens no review, progress names the next step).",
"disposition": "fixed",
"commit": "0f091ba24fef08cb1e0aad1ae3784964a82a178a"
}
]
} |
Independent reviewReviewed head 0f091ba against base cb42362. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "0f091ba24fef08cb1e0aad1ae3784964a82a178a",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/routes/brain.ts:395,412: when a review cannot open (invalid or non-UTF-8 incoming policy, not_authorized, busy), `failure` is built from the output tail before the refusal is appended, so the Activity run reason and `ui sync failed` log carry sync-mirror.ts:190's \"Sync paused... Review the policy change; approving it adopts the policy\" for a review that does not exist, and omit the real cause."
}
]
} |
Independent reviewReviewed head 0f091ba against base cb42362. Reviewer: agent. 1 finding: 1 fixed, 0 filed, 0 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "0f091ba24fef08cb1e0aad1ae3784964a82a178a",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/routes/brain.ts:395,412: when a review cannot open (invalid or non-UTF-8 incoming policy, not_authorized, busy), `failure` is built from the output tail before the refusal is appended, so the Activity run reason and `ui sync failed` log carry sync-mirror.ts:190's \"Sync paused... Review the policy change; approving it adopts the policy\" for a review that does not exist, and omit the real cause.",
"disposition": "fixed",
"commit": "bf7744157fd3daeabd50fd31766a39245e71a973"
}
]
} |
Independent reviewReviewed head bf77441 against base cb42362. Reviewer: agent. 2 findings: 0 fixed, 0 filed, 0 rejected, 2 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "bf7744157fd3daeabd50fd31766a39245e71a973",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/tests/sync-mirror.test.ts:140 and packages/ui-server/tests/sync-policy-app.test.ts:51: the only native/end-to-end tests create a first governance.md (the fixture corpus has none). The criterion and incident are an upstream commit that edits an existing policy. That path (only the file refused, non-null review baseHash, next sync merging a change made on both sides) is never exercised natively, only by the stubbed route test."
},
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:179: the bare catch around error.read(GOVERNANCE_POLICY_PATH, ...) reports every read failure (EACCES/identity fallback, 'Native private output changed while hashing', I/O) as 'exceeds the policy writer's 1 MiB bound', so the refusal records a false cause and tells the owner to shrink a file that may be small, against the fail-closed rule to record the cause."
}
]
} |
Independent reviewReviewed head bf77441 against base cb42362. Reviewer: agent. 2 findings: 2 fixed, 0 filed, 0 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "bf7744157fd3daeabd50fd31766a39245e71a973",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/tests/sync-mirror.test.ts:140 and packages/ui-server/tests/sync-policy-app.test.ts:51: the only native/end-to-end tests create a first governance.md (the fixture corpus has none). The criterion and incident are an upstream commit that edits an existing policy. That path (only the file refused, non-null review baseHash, next sync merging a change made on both sides) is never exercised natively, only by the stubbed route test.",
"disposition": "fixed",
"commit": "8f3bbd654a55fb2b043ac8b516f1d8e11e8b2a2d"
},
{
"summary": "packages/ui-server/src/brain/sync-mirror.ts:179: the bare catch around error.read(GOVERNANCE_POLICY_PATH, ...) reports every read failure (EACCES/identity fallback, 'Native private output changed while hashing', I/O) as 'exceeds the policy writer's 1 MiB bound', so the refusal records a false cause and tells the owner to shrink a file that may be small, against the fail-closed rule to record the cause.",
"disposition": "fixed",
"commit": "8f3bbd654a55fb2b043ac8b516f1d8e11e8b2a2d"
}
]
} |
… pushing its policy (#4256) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent reviewReviewed head c1eebc4 against base cb42362. Reviewer: agent. No findings. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4266,
"head": "c1eebc46d5e47aa82b511778c41a531c11d73e96",
"base": "cb4236234c1cce1f45d034e9eb34d15eda41f934",
"reviewer": "agent",
"outcome": "no-findings",
"findings": []
} |
Closes #4256
What changes
Per the 2026-11-20 ruling (option 1), a hosted sync whose pull changes
context/policies/governance.mdno longer fails forever. It publishes nothing, and the owner reviews the incoming policy.ui-sdk,worker-native-output.ts): publication still refuses every tier A change, but now names all of them up front, before any lock or write, asProtectedMaintenanceOutputError(paths, plus a boundedread(rel)of the stage's bytes, valid until cleanup). The message is unchanged.sync-mirror.ts):context/policiesdirectory a first policy creates), the host transport reads the upstream commit's policy blob (git cat-file, bounded like the stage read, withGIT_NO_REPLACE_OBJECTS=1, after the integrity fsck and fetch and before the sync's worker runs). Only when the stage's bytes equal it do they and the upstreammainSHA go to the caller'sonPolicyChange, and the sync ends paused, with nothing published or pushed. Worker output is never a policy source. A merged policy that differs from upstream's is refused with next steps. A sync without a remote pulls nothing and reviews nothing.context/policies/, change the policy in chat withpropose_policy_change. A JSON result is marked failed with the same reason.brain/owner-policy-reviews.ts): the Settings › Apify review flow, extracted unchanged into a shared helper that Apify now uses too. It hands complete content to the existing policy proposals, the only policy writer, and an approval writes inside auserjournal window. Sync reviews use their ownsync-policy-*family, and a newer sync's review replaces (declines) the owner's unanswered older one, so stale reviews never fill the four-review cap. The decide route reads only its own family and only for the proposing principal. The rationale is fixed host text: the brain's remote has this version at the named upstream commit.routes/brain.ts): after a paused sync (its Activity run endscancelledwith the reason, not as a failure, and logsui sync paused for policy review), the stream sends{ type: "policy_review", turn_id, request_id, review }and ends with{ type: "done", success: false, reason: "policy_review" }. The new internalPOST /api/brain/sync/policy/:turnId/:requestIdtakes{ approve }. An incoming policy that is not UTF-8 or does not validate opens no review: a progress line names the next step.ui-react): a paused sync shows Waiting for your policy review rather than Failed (a newwaitingstream state). The sync panel renders the review with the same exact-diff presentation as the chat policy card (kitApprovalCard/DiffBlock/Disclosure, no new visual component), sends the one answer, and tells the owner to sync again once the policy is adopted.docs/http-api.md(route row, frame and outcome),docs/integration-contract/http.md(additive entry), the ruling indocs/decisions/governed-writable-workers.md, and the ui-sdk API report.Contract: additive (a new SSE frame and outcome, a new internal route). Changesets: ui-server and ui-react minor, ui-sdk patch.
Guard checklist (proportionate containment)
The tier A output guard is unchanged in what it refuses. This PR changes how a hosted sync responds to one refusal.
context/policies/governance.md(and thecontext/policiesdirectory a first policy creates), on a sync with a remote, where the stage's bytes equal the upstream commit's blob. The host reads that blob after the integrity fsck and the fetch, before the sync's worker runs, withGIT_NO_REPLACE_OBJECTS=1. Every other tier A change, a merged policy that differs from upstream's, and any sync without a remote keep the plain refusal.policy_reviewframe and the pauseddoneframe, the UI sync's Activity run (cancelled, with the reason), and theui sync paused for policy reviewlog line. A scheduled sync's failure reason names the waiting review.sync-policy-review.test.tsshows a paused sync releases the brain for the next sync (NEXT_SYNC_REVIEWS_AGAIN), andsync-mirror.test.tsshows another tier A change still refuses on its own (TIER_A_REFUSED).Validation
tests/sync-policy-review.test.ts(real policy writer, stub boundary):policy_changeevent, and the adopted policy admitsoutward.github.repositories.tests/sync-policy-app.test.ts(native, end to end throughcreateApp, fixture corpus, local bare remote): a UI sync reviews the upstream policy commit (rationale names its SHA); approval through the decide route writes the exact bytes; the real journal recordsclass: policy, actor: user; apolicy_changegovernance event is recorded;/api/agent-policy(the next turn's facts) reports the adopted policy and its hash; the following sync completes.tests/sync-mirror.test.ts(native, fixture corpus, real Git remote):governance.mdmakes a scheduled sync refuse with "needs the owner's review".notes/sea.md).createPolicyProposals, the next sync completes and pulls the rest.bunfig.tomlkeeps its refusal with next-step text and is not reviewable.tests/render/slide-panel.test.tsx: the panel renders the review, posts{ approve: true }to the exact decide route once, and shows the adopted state.34ecb7ed4made the host boundary droponPolicyChange, which is the behaviour before this change. Draft CI run 44774074901 failed the nativesync-mirrorintegration test atUI_SYNC_PAUSED_TEXT. The next commit restores the forwarding.policy_reviewfailsSYNC_REVIEW_RENDERED.SYNC_STREAMS_POLICY_REVIEW, and all five route tests fail.FOREIGN_REVIEW_FAMILY_REFUSED.PAUSED_RUN_NOT_FAILED.SYNC_4_REVIEWS_AGAIN.bun run typecheckpasses.sync-mirrortests need user namespaces, which this host lacks, so hosted CI is their proof.Collisions
bun scripts/collisions.ts --json --pr 4266at head7c5eda572: closure-only overlaps with #3054, #3056, #3059, #3069, #3581, #4151, #4265, #4270, #4273 and #4312, through shared affected test closures. No path collisions.Refreshed by a clean merge of
origin/main(099683923). Thecheck:prreceipt below is from the last real change,c1eebc46d, and the recorded review covers that head plus this clean merge.{"version":1,"kind":"brain-check-pr-receipt","head":"c1eebc46d5e47aa82b511778c41a531c11d73e96","base":"origin/main","mode":"focused","startedAt":"2026-11-20T18:30:05.375Z","finishedAt":"2026-11-20T18:31:19.207Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":13794.882373999999},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":120.04783800000223},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":66.91902299999856},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":20.22407000000021},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":59812.825744999995}]}🤖 Generated with Claude Code