Skip to content

fix(core): recheck cgroup tokens after exec and size simulated sweeps for load - #307

Merged
ElbertePlinio merged 4 commits into
mainfrom
fix/299-300-containment-classify
Oct 8, 2026
Merged

ElbertePlinio merged 4 commits into
mainfrom
fix/299-300-containment-classify

Conversation

@ElbertePlinio

@ElbertePlinio ElbertePlinio commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Containment no longer refuses its own member when exec finishes between two reads, and the simulated sweep tests hold on a loaded host.

#299: classifyCgroupEnvironment read the environment and then the process stat in two steps. If exec finished between them, an owned member looked foreign and cleanup was refused. When the environment read was empty and stat shows exec has finished, classification now reads the environment again before it refuses. The existing start-time checks still pin the process across both reads. The second read is classified exactly like the first: a member that is gone settles, an unreadable or still mid-exec member is retried, and a settled foreign member is refused. Settled members with an empty, foreign or recycled identity are still refused.

#300: the simulated cgroup tests gave the marker sweep 500 ms for TERM and for KILL. Under very high load that expired before two empty scans. The tests now inherit the product sweep budgets of 3 s and 2 s.

Closes #299
Closes #300

Requirement Verified by Scenario Result Evidence
#299 one consistent view for classification Automated test Exec completes between the environ and stat reads Classified as ours, scope removed packages/core/test/containment-cgroup-sim.test.ts
#299 keep every refusal Automated test Settled members with empty, foreign, and recycled identity Still refused Same file
#299 deterministic regression Automated test Five new regressions Pass Same file
#299 second read mapped like the first (review round 1) Automated test Gone, unreadable, mid-exec again, token, settled foreign on the second read Seven new cases fail before, pass after containment-cgroup-sim.test.ts
#300 sweep budgets hold under load Repeat runs 96 busy loops, 30 runs; both containment files 30 runs under 32 loops Failures 15 of 30 before, 0 of 30 after; 30 of 30 ~/Artifacts/pickforge-batch4-2026-10-08/X-sol/report.md
Containment smoke Device pass Three rounds: desktop session, zenity under cgroup containment, destroy Destroy confirmed, no process or session left ~/Artifacts/pickforge-batch4-2026-10-08/qa-X
Repo checks lint, typecheck, build, PickCheck, coverage Head f64bed5 under host load about 20 All pass; 2980 tests, thresholds hold ~/Artifacts/pickforge-batch4-2026-10-08/X-cov-r2.log

Re-read an empty environment before classifying a settled cgroup member as foreign. Keep start-time checks across the token proof and signals. Cover exec completion before and after freeze, settled empty or foreign members, and PID reuse during the re-read.

Closes #299
Use the product's 3000 ms TERM and 2000 ms KILL budgets for simulated cgroup cleanup. Keep all signal, refusal, and confirmed-cleanup assertions, and show the cleanup reason when the mid-exec signal test fails.

With 96 busy loops and 30 concurrent simulated suites, failures fell from 15 of 30 runs to zero of 30 runs.

Closes #300
Classify both environment reads with the same token and mid-exec checks. Treat a vanished member as gone and an unreadable or mid-exec member as unknown. Keep settled foreign and recycled member refusals.

Add deterministic tests for vanished, unreadable, and repeated-exec reads before and after freeze, including a late mid-exec joiner. Retain the token-match, settled foreign, and PID-reuse regressions.

Closes #299
Omit explicit cleanup options so simulated cgroup tests follow the product defaults. Replace the stale 500 ms comment with the full timeout.

Closes #300
@ElbertePlinio
ElbertePlinio merged commit c22ab74 into main Oct 8, 2026
10 checks passed
@ElbertePlinio
ElbertePlinio deleted the fix/299-300-containment-classify branch October 8, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant