Repository navigation
Description
Prerequisite delivered: #2853 is closed; its pre-publication hold waiting is present on main. This issue handles a pause raised by the policy observation itself.
Context
Found while fixing #2853. Policy publication rechecks the turn inside its own journal observation, in the observeUserPolicy callback (authority(false), packages/ui-server/src/brain/policy-proposal.ts, in propose). On the in-progress #2853 change a scope pause that begins before publication is waited out, bounded, outside the brain lock, and the publication then runs. A pause that the policy's own pre-publication observation raises (the observation's scope check finds a cap reached) is still a terminal refusal: "This request no longer has current interactive authority. Nothing was written."
It cannot simply wait there: the callback runs inside the journal's hold, and the scope refuses a "continue" decision while an observation holds (turn.checking || observationHolds > 0, packages/ui-server/src/brain/turn-scope.ts:273), so the pause could not be answered. Throwing out of the callback to retry would end that observation as failed, which can stop workers (turn-scope.ts, periodic.after).
Maintainer decision and scope (2026-10-25)
Option A (original option 1) selected: when the policy pre-publication observation raises a scope pause, return an internal no-publication outcome, let that observation complete successfully, release journal holds and brain locks, then bounded-wait for the pause answer before a fresh observation/publication attempt.
- A temporary scope pause is neither revoked authority nor a failed observation. No policy bytes are staged or published in the paused callback; do not throw an observation failure merely to escape and retry. Distinguish a no-publication outcome from a completed policy update in receipts, state transitions and governance events.
- Never wait for Continue while holding the observation, transaction or brain lock needed for that decision. Release all such ownership first, then wait under one bounded deadline shared by retries.
- Continue is not permission to bypass policy checks: recheck the same live turn/principal, approval, proposed bytes, current base hash, topology and validation on a fresh attempt. A changed premise refuses as stale or requires a fresh proposal under existing rules; it does not silently transfer approval.
- Stop, cancellation, actual revocation, turn replacement and deadline expiry prevent publication and further automatic retries. They must leave no success receipt or policy-updated event. Actual observation/storage failures retain existing failure handling and are not converted into the benign no-publication result.
- Exactly one approved publication may commit. If publication occurred but later reporting/observation failed, preserve the committed evidence and existing uncertain-outcome recovery; never retry the write merely because its reply failed.
- Preserve current scope caps, headroom/Stop-only rules, policy durability and next-turn activation. Record the internal outcome/retry ownership in the applicable policy/journal decision record. No suspend/resume transaction design is selected.
Out of scope
- Pauses that begin before publication (handled by ui-server: a host write overlapping a journal observation is refused as authority_revoked #2853).
- What a scope cap itself permits.
Acceptance criteria
- A deterministic test raises a scope pause during the policy pre-publication observation. That observation finishes successfully with no publication, releases its hold/brain lock, and leaves Continue/Stop actionable. No observation-failure worker stop occurs solely because of the pause.
- Continue triggers a fresh checked observation/publication attempt and exactly one policy write/update receipt; no-publication attempts produce no policy-updated event. Repeated pauses share one finite deadline.
- Stop, cancellation, timeout, true revocation and turn replacement prevent the write and retry. Base/topology/proposed-byte or approval changes after the wait cannot reuse stale authorization.
- Real observation/storage errors still fail under existing semantics. A post-commit reporting failure cannot trigger a duplicate publication or falsely claim that nothing was written.
- Focused failing-first and restored mutations prove that waiting inside the hold is caught, suppressing the fresh authority/base check is caught, and falsely treating no-publication as success is caught. Exercise the real proposal/journal/scope interaction, alongside existing policy and scope suites.
Verification
bun run test packages/ui-server.
Contract impact
None expected.
Source reconciliation (2026-10-25): #2853 is closed and current main includes afterHolds around policy publication plus authority(false) inside observeUserPolicy. Its own-observation pause remains a refusal because Continue is blocked while observationHolds > 0. This follow-up selects a successful no-publication outcome and an outside-hold wait/retry; the earlier branch-only note is historical.
2026-10-25 triage at main 827861e1fa71cd4a26b52f1ef0f96b849381acdf: Exposed the unresolved architecture/policy question with options, consequences and an explicitly unapproved recommendation; retain the open implementation prerequisite and distinguish branch evidence from current main. No ruling or runtime proof is invented.
2026-10-25 maintainer ruling: selected A, successful no-publication observation followed by lock-free bounded wait and fully revalidated retry. Completed prerequisite #2853 is historical context, not an active blocker. Implementation and interaction/mutation proof remain open.
2026-11-03 citation check at main e6a417ba6: the Continue guard (turn.checking || observationHolds > 0) moved from turn-scope.ts:221 to turn-scope.ts:273; the other citations (observeUserPolicy callback, authority(false) in propose, periodic.after) still point at what they claim.
Activity
schlessera commentedon Oct 25, 2026
2026-10-25 triage at main
827861e1fa71cd4a26b52f1ef0f96b849381acdf: Exposed the unresolved architecture/policy question with options, consequences and an explicitly unapproved recommendation; retain the open implementation prerequisite and distinguish branch evidence from current main. No ruling or runtime proof is invented.fix(ui-server): wait out a journal observation or scope pause instead…
schlessera commentedon Oct 25, 2026
Unblocked: #2853 is closed, so
scripts/sync-project.tsis removing theblockedlabel.schlessera commentedon Oct 25, 2026
Decision (maintainer, 2026-10-25): A (original option 1). A scope pause raised by the policy pre-publication observation returns an internal no-publication outcome and completes that observation successfully. Release holds/locks before a bounded wait, then revalidate live authority, approval and base/topology on a fresh attempt. One deadline covers retries. Stop, revocation, cancellation, turn replacement or timeout prevent publication and retries. No success event for no-publication, no observation failure solely for a pause, and no duplicate write after a committed-but-unconfirmed reply. Preserve scope/durability/next-turn policy semantics. The body now gives checkable acceptance criteria; #2853 is verified delivered rather than an active blocker.
schlessera commentedon Nov 3, 2026
Claimed (token
claim-2870-9adf) for implementation on branchfix/2870-policy-observation-pausefrom mainadf371ffa. Collision check on the cited files: closure-only overlaps with open PRs (no path collision); avoiding inbox-staging files touched by #3477.schlessera commentedon Nov 3, 2026
2026-11-03: corrected a drifted citation in the body at main
e6a417ba6. The Continue guard is nowpackages/ui-server/src/brain/turn-scope.ts:273(was:221). The other cited code is unchanged in meaning.schlessera commentedon Nov 3, 2026
Draft PR #3497 (head
813f30b03) implements the ruled option A. The policy observation's own pause completes that observation unpublished, then a lock-free bounded wait runs, then a fully rechecked retry. Failing-first and three restored mutation receipts are in the PR. Remaining: hosted proof, includingbun run test packages/ui-serverand the namespace-dependent suites that can't run locally, and #3496 (citation drift already on main) forcheck:prfast invariants.fix(ui-server): a scope pause raised by the policy's own observation …