Skip to content

Checkout, possession proofs, leases, manual rotation (§3.4, §3.6) - #16

Open
Yoshiofthewire wants to merge 34 commits into
mainfrom
kyguard/broker-checkout
Open

Yoshiofthewire wants to merge 34 commits into
mainfrom
kyguard/broker-checkout

Conversation

@Yoshiofthewire

@Yoshiofthewire Yoshiofthewire commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

In one line: Ephemeral checkout works end to end: a signed vault_checkout plus a possession proof opens a lease, the broker verifies the credential once and wraps it to the requester's key only; check-in or expiry triggers the lease's cleanup rotation, and manual_rotation is in.

What changed

  • Broker (lease.go, §3.6): a relayed vault_checkout is checked against the journal (§3.4) and answered with a single-use challenge; nothing else is persisted until a proof from the transaction's cnf key verifies. Then one journal write burns request_id, consumes the challenge and opens the lease; only after that does the broker unwrap, verify the credential once at the pinned target and wrap the DEK to enc_key_id.
  • A denied verification delivers nothing, closes the lease and quarantines (§4.6).
  • Check-in (proof from the same cnf key) or expiry → rotation_pending; the cleanup rotation opid(request_id, attempt) is then the only rotation path; refusals retry at max(min-age deadline, now + 1 h) and never stop; only release closes the lease. Scheduled occurrences wait while a lease is open.
  • manual_rotation: a rotation under opid(request_id, 0) (burned with prepared), re-arms an idle cleanup, refused during an active lease, resets the refusal counter, waits for the minimum age.
  • Control Plane (migration 103): checkout_leases mirrors broker leases with one non-closed lease per account as a partial unique index; routes relay transactions, proofs and check-ins and keep a mailbox (challenge, delivery, result) for the CLI (TODO(hawthorn §7.5)).
  • CLI half: cli.NewTransaction, Checkout.Proof, cli.OpenDelivery (verifies the envelope against the CLI's trust, decrypts locally).

Review this

Checked: full suite -race + FIPS on SQLite and PostgreSQL at this tip (result in a comment below); 14 mutations (Detail), one equivalent. Not checked: standing_release and rewrap_user (next PR; the route already relays them, the broker refuses them as unknown here); the CLI commands (they need the §7.6 client); target-change deferral and lease reset evidence in enrollment (next PRs).

Decided for you (docs/DECISIONS.md 56–58): only a deterministic auth failure at delivery quarantines (an unreachable target closes the lease without quarantine); manual_rotation inside the minimum age is refused after resetting the counter; any session may read a mailbox (a challenge needs the cnf key, a delivery the requester's key).

You need to: nothing.

§13 checklist: Phase 1A "AccessTransaction for vault_checkout, … manual_rotation; approvals; possession proofs, lease, delivery, check-in, cleanup rotation". Acceptance 10 (all clauses) and the lease-cleanup clauses of 9, with a fake target. Stacked on #15.

Detail
Property Mutation Failing test
Proof verified before anything persists skip VerifyPoP TestProofOverAnotherTransactionOpensNothing
Challenge single use keep it same
Denied verification quarantines don't TestStaleCredentialAtDeliveryQuarantines
One lease at a time drop the check TestLeaseBlocksSecondCheckoutAndDefersTheSchedule
Re-check at proof time drop it TestProofRechecksForAnOpenLease
Schedule waits for the lease don't skip TestLeaseBlocksSecondCheckoutAndDefersTheSchedule
Check-in only from the cnf key skip VerifyPoP TestCheckinTriggersTheCleanupRotation
Only release closes the lease don't close same
Expiry starts the cleanup ignore expiry TestExpiryCleanupSurvivesARestart
Cleanup refusal waits an hour no wait TestRefusedCleanupRetriesAndManualRotationRearms
manual_rotation burns its request plain save TestManualRotation
manual_rotation refused during an active lease drop check same
One open lease per account in the database drop the index TestOneOpenLeasePerAccount
Cleanup never stops after three refusals count them too survived: equivalent, Cleanup never reads the counter

Review fixes (25 Nov)

  • Security reviewer (P2, lease.go): addressed by keeping lease cleanup bound to its checkout. This builds the §3.3 target-change deferral for leases (the item listed as not built above): a lease records the policy and descriptor it opened under, its cleanup runs only there, a descriptor-changing policy waits until the lease closes and survives a restart, and the Control Plane stays consistent with the broker (DECISIONS 46a). Write intents keep their existing binding.
  • Guide "Lost delivery": the checkout wrap (ciphertext) is journaled until the Control Plane acknowledges it; every tick and Recover re-send it, without a second login.
  • Guide "Lost mirror": a lease whose last state is unacknowledged is never replaced; a new checkout sends it first and is refused while it cannot.
Property Mutation Failing test
Cleanup stays at the lease's target across a target change and a restart apply the change at once TestLeaseCleanupStaysAtItsTargetAcrossADescriptorChange
The waiting change is applied once the lease closes never apply it same
Cleanup bound to the lease's descriptor drop the check TestCleanupIsBoundToItsDescriptor
Control Plane refuses a target change during a lease drop the store check TestControlPlaneRefusesADescriptorChangeDuringALease, TestDescriptorChangeWaitsForTheLease (SQLite and PostgreSQL)
A lease is recorded only under the current policy drop the store check TestLeaseUnderAReplacedPolicyDeliversNothing, TestDescriptorChangeWaitsForTheLease
Nothing is unwrapped before the lease is mirrored ignore a failed mirror TestLeaseUnderAReplacedPolicyDeliversNothing
A lost delivery is re-sent send without journaling TestLostDeliveryIsResent
An unacknowledged closure is never overwritten drop the check TestUnmirroredClosureBlocksTheNextCheckout

Restack, 25 Nov (round 2 on #10–#15)

Round-2 checks (stack tip ca19e6a): full suite -race and GODEBUG=fips140=on, SQLite (k81, exit 0) and PostgreSQL 17 (k80, exit 0); Docker connector suites -race on Major under kslot (26 tests, 0 skipped); go vet at every branch head, gofmt.

Review fixes, round 3 (25 Nov, Guide "Cleanup stalls", "Unsupported action" at a805e71)

Property Mutation Failing test
Unacknowledged cleanup receipts are re-sent on the next tick skip the re-send TestUnacknowledgedCleanupReceiptsResendOnTheNextTick (lease stays rotation_pending)
standing_release is refused at submission allow it through TestStandingReleaseIsRefusedAtSubmission (409 instead of 422)

Checks (stack tip 05c8062): full suite -race and GODEBUG=fips140=on, SQLite (k82, exit 0) and PostgreSQL 17 (k83, exit 0); Docker connector suites -race on Major under kslot at 96c38fd (30 tests, 0 skipped; nothing in the connectors changed after it); go vet and the broker, store and brokerproto tests at every merged branch head; gofmt.

Round 3c (25 Nov): merged up

Checks (stack tip e8bdff0): full suite -race and GODEBUG=fips140=on, SQLite (k83, exit 0) and PostgreSQL 17 (k80, exit 0); gofmt; Docker connector suites at 96c38fd (30 tests, 0 skipped; no connector code changed since).

Round 3d (25 Nov): merged up

Checks (stack tip 48af901): full suite -race and GODEBUG=fips140=on: SQLite at 0d637c4 (k83, exit 0), with internal/store rerun at 48af901 (k82, exit 0), since only one store test changed after 0d637c4; PostgreSQL 17 at 48af901 on Major under kslot with my own postgres:17-alpine container, exit 0 (every K host was busy). Docker connector suites -race at 0d637c4 (30 tests, 0 skipped, exit 0). gofmt.

Round 4 (25 Nov): Guide "Missing completion", main merged up

  • A manual_rotation that ran now writes the transaction mailbox: ok once the rotation reached release_authorized, otherwise the run state it stopped in (for example aborted). A manual_rotation that re-armed a pending lease cleanup answers ok. Refusals are reported as before. A result that fails to deliver is logged and not turned into a refusal, because the work is journaled.
  • Merged up from Enrollment and re-enrollment (§3.4, §4.5) #15.
Property Mutation Failing test
The CLI sees a manual rotation, or a re-arm, complete do not publish the result TestManualRotation, TestRefusedCleanupRetriesAndManualRotationRearms

Checks: at #8 ec97af5 the full suite with -race and GODEBUG=fips140=on passed on SQLite (Major under kslot, exit 0) and on PostgreSQL 17 (Major under kslot with its own postgres:17-alpine container, exit 0). At the top of the stack (#16, same tree as a350929) PostgreSQL 17 passed with -race + FIPS on k82 (exit 0). gofmt and go vet (also -tags docker) are clean at every branch head. The mutation proofs ran on throwaway copies. The top of the stack also passed SQLite with -race + FIPS (Major under kslot, exit 0).

Round 4b (25 Nov): Guide "Lost results" at a350929

  • A manual_rotation run now records its request ID (Run.Request). Once the run ends with its receipts acknowledged, or stops at write_outcome_unknown, its result is queued in the account's journaled Results. A re-armed cleanup queues ok in the same journal save as the re-arm. flush, which Tick and Recover both call, delivers the queue until the Control Plane acknowledges each entry, so a failed delivery or a restart no longer loses the result (779afb5).
Property Mutation Failing test
An undelivered result is re-sent by the next tick flush skips the results TestManualRotationResultIsResent (k81)

Checks (round 4b): at #8 f212849 and at #16 bdb9adf, the full suite with -race and GODEBUG=fips140=on passed on SQLite (Major under kslot; every K host was busy) and on PostgreSQL 17 (Major under kslot, own postgres:17-alpine container), all exit 0. #16's last head 5ef228b changes only PutTx and its test since bdb9adf: internal/store and internal/api -race passed on SQLite (k82), and the PutTx test passed 3 × 20 rounds on PostgreSQL 17. gofmt and go vet (also -tags docker) are clean at every branch head. The mutations ran on throwaway copies.

Round 4c (25 Nov): Guide "Interrupted delivery" and "Lost outcome" at 5ef228b

  • Interrupted delivery: a lease is Delivering from its open until the wrap is journaled (f612ba1). flush, which Tick and Recover both call, closes a lease still delivering as interrupted and reports that result, so a crash mid-delivery no longer blocks the account until expiry. Nothing was wrapped, so no credential left the broker.
  • Lost outcome: endDelivery queues the refusal in Results in the same save as the closure, and the existing retry delivers it.
Property Mutation Failing test
A crash between the lease open and the wrap closes the lease and reports it skip the close in flush TestInterruptedDeliveryClosesTheLease
A refusal at delivery is re-sent until acknowledged do not queue the result TestDeliveryRefusalResultIsResent

Checks (round 4c): at #16 9fb8788, the full suite with -race and GODEBUG=fips140=on passed on SQLite (Major under kslot) and on PostgreSQL 17 (Major under kslot, own postgres:17-alpine container), both exit 0. gofmt and go vet (also -tags docker) are clean at every changed branch head. The race tests ran on PostgreSQL 17 in my own container; the mutations ran on throwaway copies.

Round 5 (25 Nov): Guide "Premature refusal" and "Lost refusals" at 9fb8788

  • Premature refusal: a wrap whose delivery fails after it is journaled is pending, not refused. Proof returns nil, so nothing is published as the result, and flush re-sends the wrap (55f09a1).
  • Lost refusals: every refusal App.transaction reports goes through Machine.Refused. That journals it in a new refusals bucket and sends it. Tick and Recover re-send it until the Control Plane acknowledges it. A refusal the Control Plane rejects (RemoteError) is dropped, a later accepted message for the same request drops the stale refusal, and the bucket holds at most 1,024 (DECISIONS 79).
  • Route registry: the transaction routes go through s.route. Submitting one needs a five-minute step-up; the mailbox read, the proof and the check-in are session (DECISIONS 78).
  • The lease cleanup now runs inside Broker-local rotation scheduler (§3.4, §4.4) #12's per-account tick, under the same mutex hold as its selection. The exported Cleanup is gone (Tick was its only caller).
Property Mutation Failing test
A failed wrap delivery is not a refusal return the delivery error from deliver TestLostDeliveryIsResent
A refusal is journaled and re-sent by tick and recovery do not journal it TestRefusalsAreJournaledUntilAcknowledged
A rejected refusal does not block the rest stop at any error same
A later message supersedes a refusal keep it same
Submitting a transaction needs a fresh step-up drop fresh(StepupWindow) from submit TestBrokerActionsNeedAFreshStepUp

Checks (round 5): at 1cc8242/ae735c7 (the same code; head ae735c7 adds only main's merge of #11), go vet and the full suite with -race and GODEBUG=fips140=on passed on SQLite (Major; every K host busy) and on PostgreSQL 17 (Major under kslot, own postgres:17-alpine container), both exit 0. That head includes #12's "Stalled rotations" fix: tick recovers any stopped open run, including cleanup runs. gofmt is clean. #11 (bottom) passed the same suite at 251118d. The mutations ran on throwaway copies.

Round 5b (26 Nov): Guide "Lost result" and "Stale refusal" at ae735c7

  • Lost result: start queues the outgoing run's manual_rotation result before a new run replaces it. A manual run finished by a tick that then starts a due scheduled occurrence keeps its outcome (5e34c20).
  • Stale refusal: SetTxMailbox clears the earlier result when a new challenge is posted. A successful retry no longer reads as refused (5e34c20).
  • Merged Enrollment and re-enrollment (§3.4, §4.5) #15's "Retry Idempotency" fix.
Property Mutation Failing test
A replaced manual run's result is still delivered drop results in start TestRecoveredManualRotationKeepsItsResult
A new challenge clears an earlier refusal keep the result TestANewChallengeClearsTheEarlierResult

Checks (round 5b): at 2af3ab2, go vet and the full suite with -race and GODEBUG=fips140=on passed on SQLite (Major; every K host busy) and on PostgreSQL 17 (k81), both exit 0. The mutations ran on throwaway copies.

Round 5c (26 Nov): Guide "Stale refusal" (check-in) at 2af3ab2

  • An accepted check-in proof published no result, so a refusal of an earlier bad proof stayed in the mailbox. checkinProof now queues "ok" in Results in the same journal save as the state change, and re-sends it until it is acknowledged (2f38e14). Every other accepted path already replaces the result: a new challenge clears it, and a delivery sets "ok". Merged Enrollment and re-enrollment (§3.4, §4.5) #15's "Unusable Retry" fix.
Property Mutation Failing test
An accepted check-in replaces an earlier refusal do not queue "ok" TestCheckinTriggersTheCleanupRotation

Checks (round 5c): at af7229e, go vet and the full suite with -race and GODEBUG=fips140=on passed on SQLite and on PostgreSQL 17 (both on Major, every K host busy; PostgreSQL in my own postgres:17-alpine container under kslot), exit 0. The mutation ran on a throwaway copy.

🤖 Generated with Claude Code

@Yoshiofthewire

Yoshiofthewire commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 5 🔵🔵🔵🔵🔵

🧪 PR contains tests

⚡ Recommended focus areas for review

Stale refusal

Publishing the outcome happens after m.Tx, m.Proof or m.Checkin releases the machine mutex, while each message runs in a separate goroutine. If a failed proof is followed by a valid proof, the valid proof can complete and publish its delivery or ok before the first goroutine calls m.Refused, which then overwrites the successful mailbox result with the older error. The success path only deletes journaled refusals; it cannot undo that mailbox write. Serialize outcome publication with processing for the same request, or use ordered outcomes so an older refusal cannot supersede a newer success.


Advisory only: this comment never gates the pull request.
gpt-6.1-sol using pr-agent on behalf of Yoshi

@Yoshiofthewire

Yoshiofthewire commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

Security review - cleared

Detail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kyguard-server-16, where it is readable by the operator and expires seven days after the last post.


gpt-6.1-sol using security-audit on behalf of Yoshi

@Yoshiofthewire

Yoshiofthewire commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

Autonomous review - 1/1 personas cleared

  • security: cleared

Merging remains a human decision; this bot never approves.


gpt-6.1-sol using security-audit on behalf of Yoshi

@Yoshiofthewire
Yoshiofthewire force-pushed the kyguard/broker-checkout branch from e2c4311 to 1fac501 Compare November 25, 2026 10:58
Yoshiofthewire added a commit that referenced this pull request Nov 25, 2026
After a descriptor change, checkout opened the old target's envelope and
logged in at the new target with it (security review of #16). The
transaction and the proof now both require the current envelope's
sealing policy to pin the current descriptor; otherwise health is
needs_enrollment and nothing is opened, logged in or delivered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire
Yoshiofthewire force-pushed the kyguard/broker-checkout branch from 1fac501 to 2682387 Compare November 25, 2026 11:16
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Security P2 (checkout across a descriptor change) fixed in 2682387: the transaction and the proof both require the current envelope's sealing policy to pin the current descriptor, else ErrNeedsEnrollment with health needs_enrollment; nothing is opened, logged in or delivered. TestCheckoutAcrossADescriptorChangeIsRefused asserts zero connector logins, no lease and no delivery; it fails with the check removed.

— rowan (Claude Opus 5.5)

Yoshiofthewire added a commit that referenced this pull request Nov 25, 2026
After a descriptor change, checkout opened the old target's envelope and
logged in at the new target with it (security review of #16). The
transaction and the proof now both require the current envelope's
sealing policy to pin the current descriptor; otherwise health is
needs_enrollment and nothing is opened, logged in or delivered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire
Yoshiofthewire force-pushed the kyguard/broker-checkout branch from 2682387 to 412edae Compare November 25, 2026 12:43
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Note

🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire

Security review: addressed in 412edae.

PR Reviewer Guide: both items fixed in 412edae.

  • Lost delivery: the checkout wrap is journaled until acknowledged and re-sent by every tick and Recover (TestLostDeliveryIsResent).
  • Lost mirror: a lease whose last state is unacknowledged is never replaced; the next checkout sends it first (TestUnmirroredClosureBlocksTheNextCheckout).

Yoshiofthewire added a commit that referenced this pull request Nov 25, 2026
After a descriptor change, checkout opened the old target's envelope and
logged in at the new target with it (security review of #16). The
transaction and the proof now both require the current envelope's
sealing policy to pin the current descriptor; otherwise health is
needs_enrollment and nothing is opened, logged in or delivered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire
Yoshiofthewire force-pushed the kyguard/broker-checkout branch from 412edae to 774c895 Compare November 25, 2026 12:50
Yoshiofthewire added a commit that referenced this pull request Nov 25, 2026
After a descriptor change, checkout opened the old target's envelope and
logged in at the new target with it (security review of #16). The
transaction and the proof now both require the current envelope's
sealing policy to pin the current descriptor; otherwise health is
needs_enrollment and nothing is opened, logged in or delivered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire
Yoshiofthewire force-pushed the kyguard/broker-checkout branch from 774c895 to 643755d Compare November 25, 2026 12:56
Yoshiofthewire and others added 4 commits November 25, 2026 08:57
…3.6)

A relayed vault_checkout is verified against the broker's journal and
answered with a single-use challenge; nothing else is persisted until a
possession proof from the transaction's cnf key verifies. Then one
journal write burns the request ID, consumes the challenge and opens the
lease; only after that does the broker unwrap, verify the credential once
at the pinned target and wrap the DEK to the requester's enc_key_id. A
denied verification delivers nothing, closes the lease and quarantines.

Check-in with the same cnf key, or expiry, moves the lease to
rotation_pending. Its cleanup rotation, opid(request_id, attempt), is
then the only rotation path; refusals retry at max(min-age deadline,
now + 1 h) and never stop; only release closes the lease. Scheduled
occurrences wait while a lease is open. manual_rotation runs a rotation
under its own request, re-arms an idle cleanup, and is refused during an
active lease. Leases are mirrored to checkout_leases, which allows one
open lease per account.

The Control Plane relays transactions, proofs and check-ins and keeps a
mailbox for the CLI; cli.NewTransaction, Proof and OpenDelivery are the
CLI's half.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After a descriptor change, checkout opened the old target's envelope and
logged in at the new target with it (security review of #16). The
transaction and the proof now both require the current envelope's
sealing policy to pin the current descriptor; otherwise health is
needs_enrollment and nothing is opened, logged in or delivered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A lease now records the policy and target descriptor it opened under,
and its cleanup rotation runs only at that descriptor. While a lease is
open, a verified policy that changes the descriptor is held in the
journal and applied once the lease closes (spec §3.3).

The Control Plane stays consistent with that: it refuses such a policy
while checkout_leases holds an open lease, and records a new lease only
under the account's current policy, both under the manifest lock. The
broker touches the credential only after the lease is mirrored.

Lost Control Plane calls no longer strand a lease: the checkout wrap is
journaled until delivered, a lease whose last state is unacknowledged
is never replaced, and every tick and Recover re-send both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Yoshiofthewire and others added 3 commits November 25, 2026 14:33
A manual_rotation that ran, or that re-armed a pending lease cleanup,
never wrote the transaction mailbox, so the CLI could not tell it from
one still waiting (Guide on #16, "Missing completion"). The broker now
posts "ok" once the rotation is released or the cleanup re-armed, and
otherwise the run state it stopped in. A lost result is logged, not
turned into a refusal: the work is journaled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Note

🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire

"Missing completion" is fixed in c172a51. After a manual_rotation runs, the broker posts ok to the mailbox once the rotation is released, or else the run state it stopped in. A re-armed lease cleanup answers ok. TestManualRotation and TestRefusedCleanupRetriesAndManualRotationRearms fail when the result is not published.

Yoshiofthewire and others added 3 commits November 25, 2026 16:04
A manual_rotation result whose delivery failed was only logged; the
mailbox stayed empty while the request ID was burned, and a restart lost
it too (Guide on #16, "Lost results"). The run now records its request;
once it ends with its receipts acknowledged, its result is queued in the
account's journaled Results, and a re-armed cleanup queues "ok" in the
same save as the re-arm. flush, which Tick and Recover call, delivers
the queue until the Control Plane acknowledges each result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	docs/DECISIONS.md
#	internal/broker/app.go
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Note

🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire

"Lost results" is fixed in 779afb5. A manual_rotation result is journaled on the account and re-sent from flush, which Tick and Recover both call, until the Control Plane acknowledges it. TestManualRotationResultIsResent fails when flush skips the results.

Yoshiofthewire and others added 2 commits November 25, 2026 17:10
A crash between opening a lease and journaling its wrap left an active
lease with nothing to re-send, blocking the account until expiry (Guide
on #16, "Interrupted delivery"). A lease is now marked Delivering from
the open until the wrap is journaled, and flush, which Tick and Recover
call, closes a lease still delivering as "interrupted" and reports it.

A refusal at delivery sent its result once; a failure lost it (Guide on
#16, "Lost outcome"). endDelivery now queues the result in the
account's Results in the same save as the closure, and the existing
retry delivers it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Note

🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire

"Interrupted delivery" and "Lost outcome" are fixed in f612ba1. A lease stays Delivering until its wrap is journaled; flush (Tick/Recover) closes a lease still delivering as interrupted and reports it. Delivery refusals are queued in the journaled Results together with the closure. TestInterruptedDeliveryClosesTheLease and TestDeliveryRefusalResultIsResent each fail without their part of the fix.

Yoshiofthewire and others added 8 commits November 25, 2026 18:18
Refusals before any run or lease exists were sent once only, and a
transient wrap delivery failure was published as the transaction's
result (PR Reviewer Guide on #16, "Lost refusals", "Premature refusal").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	internal/broker/machine.go
#	internal/broker/schedule.go
Submitting a transaction needs a five-minute step-up (decision 78).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Guide, both notes fixed in 55f09a1.

  • Premature refusal: if a journaled wrap fails to deliver, it is pending, not refused. Proof returns nil, nothing is published as the result, and flush re-sends the wrap. TestLostDeliveryIsResent fails if deliver returns the delivery error.
  • Lost refusals: App.transaction reports every refusal through Machine.Refused. That journals it (refusals bucket, at most 1,024), and Tick and Recover re-send it until it is acknowledged. A refusal the Control Plane rejects is dropped, and a later accepted message for the same request supersedes it (DECISIONS 79). TestRefusalsAreJournaledUntilAcknowledged fails under each of three mutations.
    Also: the transaction routes now go through the api: classified route registry and per-action step-up (§7.5, §7.3 rule 6) #18 registry. Submitting a transaction needs a five-minute step-up (DECISIONS 78).

Yoshiofthewire and others added 5 commits November 25, 2026 19:42
… stale one

A manual_rotation recovered by a tick that then started a scheduled run
lost its result, and a mailbox kept an earlier refusal after a new
challenge (PR Reviewer Guide "Lost result", "Stale refusal" on #16).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	internal/store/vault_test.go
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Guide, both notes fixed in 5e34c20:

  • Lost result: start queues the outgoing run's manual_rotation result before a new run replaces it. TestRecoveredManualRotationKeepsItsResult fails without it.
  • Stale refusal: SetTxMailbox clears the earlier result when a new challenge is posted. TestANewChallengeClearsTheEarlierResult fails without it.

Yoshiofthewire and others added 2 commits November 25, 2026 21:32
A refused check-in proof followed by the right one left the refusal in
the mailbox (PR Reviewer Guide "Stale refusal" on #16).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Guide "Stale refusal" (check-in): fixed in 2f38e14. An accepted check-in proof now queues "ok" in Results, journaled with the state change and re-sent until acknowledged, so it replaces an earlier refusal. TestCheckinTriggersTheCleanupRotation fails without it.

@Yoshiofthewire
Yoshiofthewire changed the base branch from kyguard/broker-enroll to main November 26, 2026 03:16
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