Skip to content

State safety: cache-level check for the concurrency pair (tap v4 with pinned pools) - #148

Merged
SamMausberg merged 2 commits into
mainfrom
state/cachecheck-concurrency
Oct 1, 2026
Merged

SamMausberg merged 2 commits into
mainfrom
state/cachecheck-concurrency

Conversation

@SamMausberg

@SamMausberg SamMausberg commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Code for the last cache-level check the paper lists as pending (Appendix G, D11 state-mech): for the concurrency pair (plain decoding at concurrency 1 against 32, at most 16 running), do the caches entering the first differing module output agree? The tap v4 run answered this for plain decoding against MTP; for the concurrency pair mechanism_plain_c1_vs_c32.json names first differing module outputs only.

What it runs

experiments/state_safety/run_tap_v4_batch.sh, in one exclusive hold from a clean checkout:

  • two tapped sessions of plain decoding, at concurrency 1 and 32, each serving all 320 prompts (--load-all, as in the matrix passes) and tapping the 40 prompts of mechanism_plain_c1_vs_c32.json (tap_v4_inputs/ids_c1_vs_c32.txt, the same list the v3 c32 session tapped);
  • both servers pinned to the same pools: cap 16 (the pair's cap), 98,304 KV tokens and 80 GDN slots (the radix cache with the overlap scheduler needs 5 per running request), with GPU_STARTUP_MIN_FREE_GB=70;
  • before them, an untapped c1 pass on the same engine with the same pools (run_matrix.py --extra-flags <the cap-16 pools>, into ~/vp-data/state/runs_cap16), the reference for the tap-neutrality check;
  • then mechanism.py with the cache comparison, written to ~/vp-data/state/tap/cachecheck_v4_plain_c1_vs_c32.json. It will be committed as evidence/state_safety/cachecheck_v4_plain_c1_vs_c32.json after the hold, and the check stays pending until then.

The script refuses to start unless ~/sglang-wt/state is a clean checkout of 9341fb82 (the tap tree) and the repository checkout is clean.

tap_runs.py gains --pin, which uses server.POOL_PIN, lets pool flags in --extra-flags override it, and restarts the server until the allocated pools match, as run_matrix.py does. Its meta.json now also records repo_sha and repo_dirty, so the evidence names the commit that produced it. Existing calls without --pin behave as before.

Status

  • Engine: ~/sglang-wt/state at 9341fb82 (the tap patch), the same tree as tap v4.
  • The hold is not submitted yet. A waiter submits it as a FIFO exclusive once one of the two state exclusives already queued (first-cycle hold 1, pinned-matrix line 2) has started, as main decided. It runs this branch's checkout at its pushed head, currently be00c17. The evidence will come in a follow-up commit or PR, with the README section.
  • hold_lint.sh on the script: no findings. pre-commit (ruff, mypy, shellcheck, codespell) passes.
  • Not tested on the GPU: the v4 cache hashing has only run at concurrency 1. The tap's spans and cache hashes are per request (state_tap._spans, _cache_hashes), and the v3 tap ran at concurrency 32, but this combination has not run before.

Review

  • Codex, README (cachecheck_v4_...json described as committed): fixed in be00c17. The README says it lands after the hold.
  • Codex and the reviewer, the untapped reference had other pools: fixed in be00c17. A pool-matched untapped c1 pass on the same engine now runs first in the hold and is the reference.
  • The reviewer's suggestion: the hold now checks the engine tree and the checkout before it starts (be00c17).

…ols)

run_tap_v4_batch.sh serves every prompt with plain decoding at concurrency 1
and 32 (at most 16 running), taps the 40 prompts of the concurrency pair, and
runs mechanism.py, so the caches entering the first differing module output are
compared. tap_runs.py gains --pin (pools from server.POOL_PIN, overridden by pool
flags in --extra-flags, server restarted until it allocates exactly those) and
records the repository commit in meta.json.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 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-01T18:59:09.594093Z be00c17 Manual request
ℹ️ 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.

@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: 0dfb6e6d43

ℹ️ 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 thread experiments/state_safety/README.md Outdated
(`tap_v4_inputs/ids_c1_vs_c32.txt`) tapped. `tap_runs.py --pin` pins both servers to
the same pools (cap 16, 98,304 KV tokens, 80 GDN slots, given in `--extra-flags`) and
restarts each until it allocates exactly those sizes; `meta.json` records the pins and
the repository commit. Its summary is committed as `cachecheck_v4_plain_c1_vs_c32.json`.

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 Commit the cache-check result you document

The README claims that cachecheck_v4_plain_c1_vs_c32.json is committed, but a repository-wide filename search finds only the older mechanism_plain_c1_vs_c32.json; the new script writes its result outside Git under ~/vp-data/state/tap and never copies it into evidence/state_safety/. Consequently, the advertised cache-level result cannot be inspected or verified from this commit; either commit the generated summary with its reproduction command or stop claiming it is present.

AGENTS.md reference: AGENTS.md:L15-L18

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in be00c17: the README now says the summary will be committed to evidence/state_safety once the hold has run and that the check is pending until then. The evidence commit will follow on this branch or in a follow-up PR after the hold.

done

echo "analysis $(date +%T)"
python mechanism.py --a "$T/v4b_plain_c1" --b "$T/v4b_plain_c32" --untapped-a "$U" \

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 Compare the tap against a reference with matching pools

When this script runs, $U is the old unpinned runs/plain/c1.jsonl, while run A is explicitly started with custom pinned 98,304-token/80-slot pools. Passing that file to --untapped-a causes pool- and radix-history-induced output differences to be reported as tap mismatches, so the resulting tap_check cannot establish that instrumentation left output unchanged. Generate or select an untapped c1 reference with the same flags and pool sizes, or omit this control.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in be00c17: the hold first runs an untapped c1 pass on the same engine tree with the same pinned pools (run_matrix.py --extra-flags with the cap-16 pools, into ~/vp-data/state/runs_cap16), and that run is the --untapped-a reference. Same prompt order and request history as the tapped c1 session (both serve all 320 prompts at concurrency 1 on a fresh server).

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES (0dfb6e6, 2 blocking: Codex's two comments, both valid)

Checked.

  • tap_runs.py --pin builds its flags as config, then pool_flags(), then --extra-flags, so the extra pool flags override the pins. expected_pools is computed from the final flags, and the start-up memory gate uses min_free_gb of the same flags.
  • meta.json now records repo_sha and repo_dirty.
  • run_tap_v4_batch.sh runs with set -euo pipefail, sources sglang_env.sh, and removes earlier outputs first.
  • Without --pin, existing calls are unchanged.
  • Host identity: 0 hits.

Blocking

  1. r4159257465: the untapped reference does not match the tapped run's pools. --untapped-a points at runs/plain/c1.jsonl, the unpinned matrix run (97,672 KV tokens and 122 GDN slots in pools.json), while session A is pinned to 98,304 and 80. A tap_check mismatch would then not separate the tap from the pools or the radix history.
    • Run an untapped c1 session with the same flags and pins in the same hold. One more tap_runs.py call with no tap ids, or a run_matrix pass, would do.
    • Or drop the untapped control from this check and say so.
  2. r4159257445: the README describes a file that does not exist yet. cachecheck_v4_plain_c1_vs_c32.json is not committed. Say that it will be committed with the run, as the PR body does, and add the copy step to the command block.

Suggestion (self-review, pinning). The script relies on ~/sglang-wt/state being at the tap tree (9341fb82) and on a clean checkout, but checks neither. Refusing to start when git -C ~/sglang-wt/state rev-parse HEAD^{tree} is not the declared tree, or when git status --porcelain is non-empty, would stop a void hold before it uses the GPU. The commit is recorded afterwards, but the GPU time would already be spent.

… pending wording

Review of #148 (Codex and the reviewer): the tap-neutrality reference is now an
untapped c1 pass on the same engine with the same pinned pools, not the unpinned
matrix run; the hold refuses to start unless ~/sglang-wt/state is a clean
checkout of 9341fb82 and the repository checkout is clean; and the README says
the summary will be committed after the hold, not that it is.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (provisional, on be00c17: Codex is still running on this head, and pre-commit is queued in the CPU window. I will confirm or withdraw once both finish.)

be00c17 resolves both blocking items and takes my suggestion.

  • Pool-matched reference. The hold now runs an untapped plain c1 pass first, with run_matrix.py --extra-flags "$POOLS" into ~/vp-data/state/runs_cap16. That is the same engine and the same cap-16, 98,304-token, 80-slot pins (run_matrix appends the extra flags after pool_flags(), and expected_pools checks the result). It uses that pass as --untapped-a, and the old directory is cleared first.
  • Wording. The README says the summary will be committed after the hold and that the check is pending until then.
  • Guards. The script exits before any server starts unless ~/sglang-wt/state is a clean checkout of 9341fb82 and the repository checkout is clean, and it prints both SHAs.
  • hold_lint.sh on the script: no errors.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: be00c17445

ℹ️ 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".

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (confirmed on be00c17)

This confirms my provisional approval. Codex found no issues on this head (18:59 UTC), and pre-commit from main to be00c17 is clean.

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