Repository navigation
W3-03f: RAM-pressure capacity drill kit - #380
Conversation
Sampler for OS memory and the capacity snapshot (via the pa CLI), verdicts for limits 2/1/0, no claim at critical, no reclaim, a bounded memory-pressure helper and the German step doc. Continuous OFF is observation only. Test-First: scripts/lib/capacity-drill.test.mjs::thresholds give limit 2/1/0 and fail closed to 1 Test-First: scripts/lib/capacity-drill.test.mjs::parseSnapshot reads admission fields and tolerates absence Test-First: scripts/lib/capacity-drill.test.mjs::evaluate passes a full normal to critical and back run with constant claims Test-First: scripts/lib/capacity-drill.test.mjs::evaluate flags a reclaimed worker and a claim at critical and a missing stage Test-First: scripts/lib/capacity-drill.test.mjs::evaluate flags a wrong limit and an unavailable measurement that is not limit 1 Test-First: scripts/lib/capacity-drill.test.mjs::with Continuous off the run is observation only and never fails on admission Test-First: scripts/lib/capacity-drill.test.mjs::API errors are not a pass and bundle text carries no token Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Queued — the merge queue status continues in this comment ↓. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 899598c1b2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| outDir, appVersion: v['app-version'], commit, projects: v.project, | ||
| continuous: v.continuous === 'on', durationSec: Number(v.seconds), |
There was a problem hiding this comment.
Verify Continuous is actually enabled
When the operator passes -Continuous on, this Boolean becomes the sole authority for issuing an admission verdict; the returned context's control.status is never checked. Because the default v1.5 app can be paused while still exposing hostAdmission and retaining existing claims, the stages and counts can satisfy the evaluator and produce a row-10 pass even though Continuous admission is disabled. Require every sampled project to report control.status === "enabled" before treating the run as evidence.
AGENTS.md reference: AGENTS.md:L118-L123
Useful? React with 👍 / 👎.
| if (claims.length && claims[0] < 1) problems.push('no admitted work at start: nothing to observe'); | ||
| if (claims.length && claims.at(-1) < claims[0]) problems.push(`claims fell from ${claims[0]} to ${claims.at(-1)}: existing work was reclaimed`); | ||
| if (critical.length && Math.max(...critical) > critical[0]) problems.push(`claim count rose at critical (${critical[0]} -> ${Math.max(...critical)})`); |
There was a problem hiding this comment.
Track claim identities before passing the drill
When an original claim completes during the critical stage and a forbidden new claim replaces it, the aggregate count can remain at or below critical[0] and finish equal to its initial value, so both checks pass despite the admission guarantee being violated. The inverse also causes ordinary task completion to be reported as pressure reclaim. A host-wide count cannot establish either worker survival or rejection of the attempted task; record claim identities or the attempted claim's result instead.
AGENTS.md reference: AGENTS.md:L40-L43
Useful? React with 👍 / 👎.
| bundle.step(continuous ? 'admission limits 2/1/0, no new claim at critical, no reclaim' : 'observation only (Continuous OFF): no admission verdict', | ||
| { exitCode: continuous && verdict.problems.length ? 1 : 0, detail: verdict.problems.join('; ') || `stages: ${verdict.stages.join(',')}` }); |
There was a problem hiding this comment.
Fail observation-only runs with no snapshots
When Continuous is off and every pa hq context call fails or lacks hostAdmission, evaluate() records no capacity snapshot could be read, but this conditional forces exit code 0 solely because continuous is false. The launcher consequently prints Ergebnis: pass even though the promised observation did not occur; observation-only mode should suppress admission-specific failures, not missing-observation failures.
AGENTS.md reference: AGENTS.md:L40-L43
Useful? React with 👍 / 👎.
| options: { pa: { type: 'string', default: 'pa' }, project: { type: 'string', multiple: true }, out: { type: 'string' }, | ||
| 'app-version': { type: 'string' }, commit: { type: 'string' }, 'process-list': { type: 'string' }, | ||
| continuous: { type: 'string', default: 'off' }, seconds: { type: 'string', default: '600' } }, | ||
| }); |
There was a problem hiding this comment.
Require two distinct projects for the cross-project drill
When the launcher receives only one project, or receives the same ID twice, this guard accepts the input and the snapshots object collapses duplicate keys, allowing all stage and claim-count checks to pass using a single project. The drill instructions require work in at least two projects, so such a manifest does not observe the cross-project scenario it claims to exercise; reject fewer than two unique project IDs.
AGENTS.md reference: AGENTS.md:L40-L43
Useful? React with 👍 / 👎.
| $target = [Math]::Max($target, $floorMiB) | ||
| Write-Host "Stufe: verfuegbar auf ca. $target MiB druecken" | ||
| while ((Get-AvailableMiB) -gt $target -and (Get-Date) -lt $deadline) { | ||
| $chunk = [byte[]]::new(64MB) | ||
| for ($i = 0; $i -lt $chunk.Length; $i += 4096) { $chunk[$i] = 1 } # touch pages so they are really resident |
There was a problem hiding this comment.
Preserve the promised memory floor during allocation
When a caller supplies a stage near the exposed 256 MiB floor, such as -StagesAvailableMiB 256, or another process consumes memory between the check and allocation, the loop can see free memory just above the target and then commit and touch another fixed 64 MiB chunk, pushing the machine below the floor before the next check. Clamping the target does not enforce the safety reserve; size or skip each allocation based on available - floor so the pressure helper cannot violate its stated bound.
AGENTS.md reference: AGENTS.md:L44-L46
Useful? React with 👍 / 👎.
| const want = expectedLimit(snap.totalBytes, snap.availableBytes); | ||
| if (snap.limit !== want.limit) problems.push(`${t} ${project}: limit ${snap.limit} for ${snap.availableBytes}/${snap.totalBytes} bytes, expected ${want.limit}`); |
There was a problem hiding this comment.
Compare capacity snapshots with independent OS samples
When ProjectA's memory sensor reports inaccurate totalBytes or availableBytes but returns a limit consistent with those inaccurate values, this check derives the expected limit from the same API response and accepts it. The independently collected s.os measurement is only reduced to a minimum for the report and never correlated with the snapshot, so a sequence can cover all three stages and pass without proving that admission changed at the host's real RAM thresholds. Compare the API memory reading and stage against the contemporaneous OS sample, with an explicit timing tolerance.
AGENTS.md reference: AGENTS.md:L16-L18
Useful? React with 👍 / 👎.
Keep Continuous-off runs observation-only for admission mismatches, but fail closed when any requested HQ capacity snapshot cannot be read. Test-First: scripts/lib/capacity-drill.test.mjs::with Continuous off a missing capacity snapshot still fails the observation
|
@Mergifyio queue |
Merge Queue Status
This pull request spent 28 minutes 3 seconds in the queue, including 14 minutes 16 seconds running CI. Required conditions to merge
|
Dieses Paket liefert den Drill für Matrixzeile 10: Er misst alle zwei Sekunden den freien Arbeitsspeicher und die Kapazitätsanzeige von ProjectA, während ein Hilfsskript kontrolliert und nur im eigenen Prozess Speicher belegt. Die deutschsprachige Anleitung führt Schritt für Schritt durch den Lauf auf dem Windows-PC. Wichtig bleibt: Mit ausgeschaltetem Continuous ist der Lauf nur eine Beobachtung und kein Beleg für Matrixzeile 10.
Report
What changed
scripts/lib/capacity-drill.mjs, which mirrors the runtime capacity thresholds, samples the authenticatedpa hq contextclient, and evaluates the 2/1/0 admission stages.finally.e1860d1: a missing requested HQ capacity snapshot now fails closed even when Continuous is off; admission mismatches remain observation-only in that mode.Evidence
node --test --test-name-pattern="with Continuous off a missing capacity snapshot still fails the observation" scripts/lib/capacity-drill.test.mjs— exit 1 before the fix, exit 0 after the fix.node --test scripts/lib/capacity-drill.test.mjs— exit 0, 8 passed.bash scripts/ci/red-first.sh— exit 0, 8/8 exact Test-First specifications absent at the merge base and green ate1860d1.node scripts/ci/architecture-drift.mjs check— exit 0, no new occurrences.bash scripts/ci/gates.sh lane precommit(commit hook) — exit 0.bash scripts/ci/gates.sh lane prepush— exit 0; repeated by the push hook with exit 0.git ls-remote origin refs/heads/claude/w3-03f-drill-capacity— exit 0, remote SHAe1860d181538c1e6983969f50f67dc932668ef8c.Architecture drift
The initial implementation had already replaced a raw authenticated fetch with the canonical
pa hq contextclient. The review found no second state owner, transport/error contract, store/lock pattern, IPC naming pattern, or Rust-to-frontend event path; the architecture-drift gate reports no new occurrence and no allowlist entry was added.Review disposition
899598c1b20a790b1ff746f5c53a9d0e137f4286; final candidate after accepted fix and delta re-check:e1860d181538c1e6983969f50f67dc932668ef8c.scripts/lib/capacity-drill.mjs:72: with Continuous off, snapshot/API failures were recorded inproblemsbut forced to exit code 0, contradictingdocs/drills/capacity-drill.md:47and the report's fail-closed claim. Counter-check: the existing observation-only test covered admission mismatches, not absence of the observation source; the finding therefore held. Accepted and fixed ine1860d1, with red-first regression testscripts/lib/capacity-drill.test.mjs:45::with Continuous off a missing capacity snapshot still fails the observation.NICHT ABGEDECKT
#[cfg(windows)]tests, the Windows arms of clippy,GlobalMemoryStatusEx, or the PowerShell drill scripts; the Windows lane runs in the merge queue.pa hq contextagainst the installed app is not verified here; a missing requested snapshot now fails closed.Open points