Repository navigation
Conversation
Follow-ups from the reviews of #1176 and #1178, all fail-closed. - Cgroup-ID watermark: when restart survival cannot read the previous run's pins (or an unavailable section kept them), AdoptedPending answers "clear" only for cgroups created after node-agent's own cgroup; older cgroups, cgroup 0 and an unreadable or root watermark still refuse. Assumes one node-agent per node (DaemonSet maxSurge 0), documented in docs/features/sandbox-policy.md. - A cgroup held back at Synchronize by an unproven sibling sandbox is re-proven once that sandbox is gone, from a classification at or after Synchronize's sequence (batch 12). - ErrInheritedStrictMark (wraps ErrPolicyEntry) is retried, never memoized as settled. - A per-pod commit counter refuses a create whose last read-back was overtaken by a newer plan commit (the admission stale window). - Batch 18: a Selected pod with no pod-markable section is unmarked through the shared backoff unless it is Strict with a shape; one helper serves both the refresh and the reclassify path. - An alternating Unknown no longer resets the write backoff. - Stale comments; tests including an end-to-end run through the real section backend and node owner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
Follow-ups from the reviews of #1165 and the re-merge review, all fail-closed. - One cgroup walk serves all of a refresh's pathless gone checks; only a successful walk is reused (at most 0.5 s), a failed walk decides nothing and is not cached. - One uncached mirror re-read per refresh covers every static unmark. - MarkPod clears refusedPlan only at a strictly newer sequence with the wanted plan, so status never claims protection it did not hold. - sandboxpolicy.StaticPod and ConfigSourceAnnotation are the single static-pod rule (ClassifyPod, the Service and toGate). - Service.Close closes the gate before the fence join; gate.close returns nil once no worker is left. - TestServiceReportsUnexpectedExporterExit no longer hangs (its own OnError blocked on a 1-slot channel) and runs in the normal suite. - Tests: the merge/bind window (deterministic), fence-aware Close retries, static pod -> mirror -> unmark end to end, an http-only policy through classification and the plugin; session-local references removed from test comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Docs-exempt: internal fixes and tests in the unreleased NRI start gate stack Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
Conflicts in the reclassify backoff: - service.go: noPodSections(c) (batch 18) with #1178's backingOff(uid, outcomeKey(c)). - nrigate.go: #1178's join of every failed section, using sectionSettled so ErrInheritedStrictMark stays a retried failure; Unknown never backs off and keeps the outcome+cgroup history (C2); #1178's stale-only clear kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Docs-exempt: merge of the unreleased NRI start gate stack Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
|
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
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
🟡 Changes recommended
In-flight backend writes can leave stale cached confirmations admitting pods without an effective Strict mark, while refresh queue starvation can indefinitely block eligible cgroups.
2 open issues
What changed in this PR
This PR follows up on the NRI start-gate work, improving restart recovery, admission checks, retry behavior, and shutdown coordination.
Changes:
- Adds cgroup watermarks and delayed re-proof for inherited marks.
- Updates admission tracking, mark retries, static-pod handling, and cleanup.
- Expands regression coverage and documents deployment assumptions.
| File | Description |
|---|---|
| pkg/sandboxpolicy/types.go | Adds inherited-mark error sentinel. |
| pkg/sandboxpolicy/startgate/plugin.go | Tracks sandboxes holding back re-proof. |
| pkg/sandboxpolicy/startgate/plugin_test.go | Extends the fake gate for re-proof. |
| pkg/sandboxpolicy/startgate/fu2_reprove_test.go | Tests re-proof and mark preservation. |
| pkg/sandboxpolicy/sections.go | Adds watermark and re-proof interfaces. |
| pkg/sandboxpolicy/integration/service.go | Batches mirror checks and adjusts shutdown order. |
| pkg/sandboxpolicy/integration/service_test.go | Prevents exporter-test callback blocking. |
| pkg/sandboxpolicy/integration/podgate.go | Tracks commits and improves close handling. |
| pkg/sandboxpolicy/integration/podgate_fu2b_test.go | Tests binding order, mirror batching, and close. |
| pkg/sandboxpolicy/integration/podgate_fu2b_close_linux_test.go | Tests fence-aware shutdown retries. |
| pkg/sandboxpolicy/integration/podgate_finishedjob_test.go | Updates a test comment only. |
| pkg/sandboxpolicy/integration/nrigate.go | Implements watermarks, re-proof, and retry changes. |
| pkg/sandboxpolicy/integration/nrigate_static_test.go | Uses the shared annotation constant. |
| pkg/sandboxpolicy/integration/nrigate_fu2b_vmtest_test.go | Tests static and HTTP-only pods through the plugin. |
| pkg/sandboxpolicy/integration/gateoff_golden_test.go | Updates a provenance comment only. |
| pkg/sandboxpolicy/integration/fu2_gate_test.go | Adds gate recovery and admission regressions. |
| pkg/sandboxpolicy/integration/cgroupgone_linux.go | Reuses successful cgroup walks briefly. |
| pkg/sandboxpolicy/integration/cgroupgone_linux_test.go | Tests walk batching and failure handling. |
| pkg/sandboxpolicy/igbackend/statusrefused_s3_test.go | Tests clearing refused-plan status. |
| pkg/sandboxpolicy/igbackend/restart.go | Identifies unread retained pins. |
| pkg/sandboxpolicy/igbackend/nodeowner.go | Tracks refusal sequences and inherited marks. |
| pkg/sandboxpolicy/igbackend/nodeowner_syncproof.go | Records sequence-validated cgroup re-proof. |
| pkg/sandboxpolicy/igbackend/nodeowner_podgate_test.go | Checks inherited-mark error distinctions. |
| pkg/sandboxpolicy/igbackend/fu2_gate_test.go | Tests restart errors and re-proof constraints. |
| pkg/sandboxpolicy/classify.go | Centralizes static-pod detection. |
| pkg/sandboxpolicy/classify_test.go | Uses the exported annotation constant. |
| docs/features/sandbox-policy.md | Documents single-agent and watermark assumptions. |
Review effort: Balanced
Copilot on #1231 (047d6c5). - podGate counts each pod's started, unfinished writes (the mark job, the unmark job and the refresh's BindPodsAt). A hold whose wait expires while one is outstanding returns no confirmation, so the create is refused instead of admitted on a cached Strict read-back that the write may already have replaced. The commit is counted before the write ends, and every count is ended by defer (4811942032). - reproveHeld walks its queue with a rotating cursor and checks its budget on the gate's clock, so one slow lookup cannot starve the cgroups behind it (4811942065). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Docs-exempt: internal fixes in the unreleased NRI start gate stack Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
Copilot 4812087571 on #1231 (ed2e942). ProveNRICgroup took the node owner's mutex unconditionally, so a hold worker publishing a slot could stall the whole re-proof pass past its budget. NRICgroupProver.ProveNRICgroup now takes a deadline, SectionBackend passes it to every section, and nodeOwner waits with the deadline- bounded lockBy. A busy owner records nothing and returns false, so the cgroup stays queued and unproven; the rotation continues with the rest. A cgroup counts as proven only when every section proves it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Docs-exempt: internal fix in the unreleased NRI start gate stack Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
Performance Benchmark ResultsNode-Agent Resource Usage
Dedup EffectivenessNo data available. |
Copilot 4812211330 on #1231 (4e3167a). The commit stamp and in-flight check ran only when a hold ended without confirmation, so a refresh that replaced the binding between the worker's read and its use could still be admitted on a stale Confirmed answer. One current() check (same entry, not released, no commit since the stamp, no write in flight) now guards every hold exit that returns confirmations. A stale Confirmed read is re-read; at the deadline the create is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Docs-exempt: internal fix in the unreleased NRI start gate stack Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
Performance Benchmark ResultsNode-Agent Resource Usage
Dedup EffectivenessNo data available. |
There was a problem hiding this comment.
🔵 Needs a closer look
The admission relaxation depends on kernel cgroup-ID ordering and non-overlapping node-agent restarts that require human validation, since real containerd/kernel VM qualification was not run.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
Performance Benchmark ResultsNode-Agent Resource Usage
Dedup EffectivenessNo data available. |


Summary
Follow-ups from the reviews of #1165 (S3), #1176 (S5) and #1178 (S5b): the start-gate plugin, nriGate, the pod gate and the Service. Stacked on #1178. Every change fails closed.
Restart survival
AdoptedPendingnow answers "clear" only for cgroups created after node-agent's own cgroup. Older cgroups, cgroup 0, and an unreadable or root watermark still refuse. Previously every Unselected, sectionless and exempt container on the node was refused for the whole run. This assumes one node-agent per node (DaemonSetmaxSurge: 0, the chart default), documented indocs/features/sandbox-policy.md.ErrInheritedStrictMark(wrapsErrPolicyEntry) is retried, never memoized as settled.Admission and marks
MarkPodclearsrefusedPlanonly at a strictly newer sequence with the wanted plan.Pod gate and Service
sandboxpolicy.StaticPodis the single static-pod rule.Service.Closecloses the gate before the fence join.TestServiceReportsUnexpectedExporterExitno longer hangs (its own callback blocked on a 1-slot channel) and runs in the normal suite again.Tests: end-to-end through the real section backend and node owner; a static pod unmarked through its mirror; an http-only policy through classification and the plugin; the merge/bind window (deterministic); fence-aware Close retries; stale comments fixed.
Validation:
go teston./pkg/sandboxpolicy/...and the gadget packages in default,-tags startgate_vmtestand-race, with no skipped test; the release check (no release binary can run the start gate).AI Review
Written with Claude Code (Claude Opus 5.5). Independent adversarial reviews of each part and of the merge with #1178. One HIGH was found and fixed: the first version also unmarked Strict pods with a shape, removing the pod mark that judges a container whose own binding is missing; the rule was narrowed and pinned by a test over all Strict/shape combinations. All LOW findings were fixed, and every re-check approved.
🤖 Generated with Claude Code
AI-skills: gh-review | cmds: /goal,/compact