Skip to content

W3-03f: RAM-pressure capacity drill kit - #380

Merged
mergify[bot] merged 2 commits into
mainfrom
claude/w3-03f-drill-capacity
Oct 4, 2026
Merged

mergify[bot] merged 2 commits into
mainfrom
claude/w3-03f-drill-capacity

Conversation

@Cuarroc

@Cuarroc Cuarroc commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

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

  • Added scripts/lib/capacity-drill.mjs, which mirrors the runtime capacity thresholds, samples the authenticated pa hq context client, and evaluates the 2/1/0 admission stages.
  • Added the Node and PowerShell launchers plus a bounded memory-pressure helper that releases its allocations in finally.
  • Added the German operator guide and eight focused tests.
  • Review fix 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 at e1860d1.
  • 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 SHA e1860d181538c1e6983969f50f67dc932668ef8c.

Architecture drift

The initial implementation had already replaced a raw authenticated fetch with the canonical pa hq context client. 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

  • Reviewer: Codex (OpenAI), independent from the Claude author family; tier B.
  • Reviewed candidate: 899598c1b20a790b1ff746f5c53a9d0e137f4286; final candidate after accepted fix and delta re-check: e1860d181538c1e6983969f50f67dc932668ef8c.
  • RB-1 — medium — scripts/lib/capacity-drill.mjs:72: with Continuous off, snapshot/API failures were recorded in problems but forced to exit code 0, contradicting docs/drills/capacity-drill.md:47 and 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 in e1860d1, with red-first regression test scripts/lib/capacity-drill.test.mjs:45::with Continuous off a missing capacity snapshot still fails the observation.
  • No other functional or architecture findings survived counter-checking; no high-severity finding remains open.

NICHT ABGEDECKT

  • The Linux run does not compile or execute the #[cfg(windows)] tests, the Windows arms of clippy, GlobalMemoryStatusEx, or the PowerShell drill scripts; the Windows lane runs in the merge queue.
  • The output shape of pa hq context against the installed app is not verified here; a missing requested snapshot now fails closed.
  • Admission exists only with Continuous on; with it off, row 10 remains open.
  • Memory-unavailable fail-closed behavior cannot be deliberately provoked on the PC; the Rust unit test covers it and the drill checks it only if observed.
  • Worker survival is inferred from claim counts rather than tracked per worker process.
  • No GUI or installed-app drill was run; the user performs that drill.

Open points

  • Await the ready-PR checks and the Windows merge-queue lane.
  • The user-run installed-app drill remains the required runtime evidence for matrix row 10.

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>
@Cuarroc
Cuarroc marked this pull request as ready for review October 4, 2026 20:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T21:03:12.011716Z 899598c Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mergify

mergify Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +21 to +22
outDir, appVersion: v['app-version'], commit, projects: v.project,
continuous: v.continuous === 'on', durationSec: Number(v.seconds),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +46 to +48
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)})`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread scripts/lib/capacity-drill.mjs Outdated
Comment on lines +71 to +72
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(',')}` });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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' } },
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +16 to +20
$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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +39 to +40
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}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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
@Cuarroc

Cuarroc commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

@Mergifyio queue

@mergify

mergify Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

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

@mergify
mergify Bot deleted the claude/w3-03f-drill-capacity branch October 4, 2026 21:52
@mergify mergify Bot removed the queued label Oct 4, 2026
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