Repository navigation
Conversation
Add a small library target to buzz-backend-kubernetes that holds the
Agent Sandbox session lifecycle: the annotation keys and values, a pure
classifier that maps an observed Sandbox, Pod, and apiserver time to one
lifecycle state, and the checkpoint receipt that binds a tombstone to
the session's own checkpoint prefix. The provider binary and the
in-cluster reaper share it, so naming.rs now re-exports the management
marker from the library instead of spelling it twice.
The harness writes the saved checkpoint key to the kubelet-mounted
termination log as {"version":1,"checkpoint":"<key>"}. It never creates
the file, so local runs are unaffected.
Signed-off-by: Tee8z <tee8z@protonmail.com>
tee8z
force-pushed
the
dev-2884-lifecycle-contract
branch
from
October 19, 2026 23:28
14d27d8 to
daf9690
Compare
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The desktop provider and the in-cluster
buzz-sandbox-reapermust agree on the state of each Agent Sandbox session.This PR adds a library target,
buzz_backend_kubernetes::lifecycle, with the lifecycle annotation keys and a pure classifier.classify()reads oneObservationof the Sandbox, its Pod, and the apiserver clock, and returns oneState.The harness in
buzz-acpnow records its saved checkpoint key where the reaper can read it.stateDiagram-v2 state "Ignored (unmarked)" as Unmarked state "Ignored (foreign-owner)" as ForeignOwner state "Ignored (foreign-pod)" as ForeignPod state "Ignored (inconsistent)" as Inconsistent state "Ignored (not-running)" as NotRunning state cMarker <<choice>> state cOwner <<choice>> state cDeleting <<choice>> state cLifecycle <<choice>> state cEnding <<choice>> state cMode <<choice>> state cPod <<choice>> state cBinding <<choice>> state cContainer <<choice>> [*] --> cMarker cMarker --> Unmarked : no management label, or binding version is not 2 cMarker --> cOwner : marked cOwner --> ForeignOwner : owner annotation differs cOwner --> cDeleting : owner matches cDeleting --> Draining : Sandbox deleting cDeleting --> cLifecycle : not deleting cLifecycle --> Ended : ended and Suspended cLifecycle --> cEnding : ending cLifecycle --> Inconsistent : ended but not Suspended, or unknown value cLifecycle --> cMode : no lifecycle annotation cEnding --> Draining : owned Pod present cEnding --> ForeignPod : foreign Pod present cEnding --> Ending : no Pod cMode --> NotRunning : operatingMode is not Running cMode --> cPod : Running cPod --> ForeignPod : Pod not owned by the Sandbox cPod --> Draining : owned Pod deleting cPod --> cBinding : no Pod, or owned live Pod cBinding --> Binding : no initial-pod-uid cBinding --> Lost : bound, no Pod cBinding --> Replaced : Pod UID differs from initial-pod-uid cBinding --> cContainer : Pod UID matches cContainer --> BindingIncomplete : never started cContainer --> Active : running cContainer --> Completed : terminatedBIND_TIMEOUT_SECSBinding { abandoned },BindingIncomplete { expired }LOST_GRACE_SECSLost { confirmed }ENDED_RETENTION_SECSEnded { expired }MISSING_CHECKPOINT_HOLD_SECS(24 h) is defined for the reaper;classify()does not use it.An
Endingstate without anended-reasonannotation usesstopped.Checkpoint receipt:
buzz-acpwrites{"version":1,"checkpoint":"<key>"}to/dev/termination-log.receipt_key()accepts only version 1 and a key directly under the session prefix<developer prefix><generation>/.naming.rsnow re-exportsMANAGED_BY,LABEL_MANAGED_BY,LABEL_BINDING_VERSION, andANNOTATION_PUBKEY_FULLfrom the library.Stack
Position 7 of 20 in the DEV-2884 Buzz stack. Base: #1. Next: #14.
Validation
cargo fmt --check -p buzz-acp -p buzz-backend-kubernetes: pass.cargo clippy -p buzz-backend-kubernetes --all-targets -- -D warnings: pass.cargo clippy -p buzz-acp --all-targets -- -D warnings: pass.cargo test -p buzz-backend-kubernetes: lib 12 passed; bin 167 passed, 1 ignored;wire_fixtures5 passed.cargo test -p buzz-acp checkpoint: 5 passed.cargo test -p buzz-acp: 1069 passed, 3 ignored; other test binaries 4, 9, 9, 1 passed. Run on the stack head;crates/buzz-acpdoes not change after this PR.Limits
live_controller_reuses_scopes_and_refuses_lost_workspacesneeds thekind-remote-agent-checkcluster. It was not run.sandbox.rsstill keeps its own copies of the annotation keys and helpers. The next PR in the stack moves it onto the library.