Repository navigation
PR-CI: discriminating token-tool tests for context-mode, Serena, ai-memory, context-hub, agentsview and an RTK exactness fix - #375
Conversation
GPT-6's cross-family review of #375 found that Run.clean() -- the sanitizer every fixture's retained command/observation output already routes through -- did not redact two categories scripts/validate.py's own PRIVATE_CONTENT scanner already defines: bare UUIDs and personal home paths. Confirmed directly against the real hosted-CI artifact (run 36283215966's receipt.json): ai-memory 2.4.1 generates its own UUID-shaped page/workspace path components (new in this PR's ai_memory_fixture), and the pinned agentsview v0.43.0 binary's own --help text has an upstream-authored example path under /home/me that matches the scanner's pattern (only /home/example is exempted). A third, pre-existing instance from markitdown's ONNX runtime dependency (a UUID-shaped PCI bus id in stderr warnings) will also now be redacted, as a side effect of fixing the shared clean() method rather than patching each fixture. Run.clean() now applies the two PRIVATE_CONTENT regexes (copied verbatim, cited by source and kept literal-first: the existing substitutions still run before these) as a redaction pass after its existing literal substitutions. Five failing-first tests: redaction of a fabricated UUID and a fabricated home path; preservation of the /home/example and /Users/example exemptions and of ordinary non-matching text; no regression to the existing literal substitutions; and an explicit ordering test that fails under a regex-before-literal mutation. Not done here, and flagged as a residual instead: a validate.py --scan-file gate on the workflow's own artifact upload, which would be a wider, all-17- tools concern closer to the plan's separate evidence-sanitization lane than this PR's six tools. Co-Authored-By: Claude Sonnet 5 <[email protected]>
GPT-6 cross-family review (
|
| # | Finding (severity) | Verdict | Evidence checked | Resolution |
|---|---|---|---|---|
| 1 | Run.clean() doesn't redact UUID-shaped or personal-home-path text; the repo's own scripts/validate.py scanner would flag it (medium) |
Holds | Downloaded the hosted run's own native-token-e2e-results artifact (run 36283215966) and read receipt.json directly: state_observations["ai-memory-store"] lists real ai-memory-generated paths with UUID components (new, from this PR's ai_memory_fixture); agentsview --help's own text contains an upstream example under /home/me (new, from agentsview_fixture); a third, pre-existing instance from markitdown's ONNX dependency (a PCI-bus-id warning, one of the 11 tools #370 already covered) confirmed the gap predates this PR. Confirmed scripts/validate.py's PRIVATE_CONTENT tuple's "local session identifier" and "personal home path" patterns match all three verbatim, and its scan_file_for_private_content docstring already anticipates exactly this case for generated/uploaded artifacts. |
Fixed in two steps, each verified against a real hosted artifact rather than trusting the green checkmark alone: (a) commit aa40bf70 added both PRIVATE_CONTENT patterns to Run.clean() as a redaction pass after its existing literal substitutions, with 5 failing-first tests including a mutation test on the literal-first/regex-second ordering; (b) re-downloading the next hosted run's artifact (commit aa40bf70, run 36284521807) still showed two raw UUIDs in state_observations["ai-memory-store"], because Run.observe() never routed its path list through clean() at all — fixed in commit 656faf02 (same one-line pattern, same source, one more failing-first test, confirmed failing by reverting the line and restoring it). Not done (flagged as a residual instead): a validate.py --scan-file gate on the workflow's artifact-upload step — that would cover all 17 tools' artifacts (the pre-existing markitdown instance included), which is a wider concern than this PR's six tools and closer to the plan's separate evidence-sanitization lane. |
| 2 | The PR/scope description of the diff size understated it ("one-line fix", "+651/-0") against the real base-relative diff (low) | Holds | Verified independently: git diff 34c56340 41072a72 --numstat → scripts/native_token_ci.py 779 29, tests/test_native_token_ci.py 670 6 — matches the review's own cited numbers exactly. The smaller figures described only this integrator's second local commit relative to its first, a distinction real in local git history but invisible in the PR itself, since the repository's hot-file rebase protocol squashes both local commits into the one commit the PR contains. |
Fixed: edited the PR body (before this push, per this repository's own body-edit-before-push rule) to state the full base-relative diff and explain why it isn't independently separable into "pre-existing" and "added" parts once pushed; corrected scope.md the same way for the record. |
Hosted native-token-e2e.yml results
First run, 36283215966 (commit 41072a72, before the repair round): success, all steps green. receipt.json: status: "passed", failures: [], 82/82 checks true.
| Tool | New checks | Result |
|---|---|---|
| RTK hook-check | 4 | all true |
| RTK exactness | 8 | all true |
| context-mode | 5 | all true |
| Serena | 4 | all true — resolves the one residual noted in scope.md: serena-initialize-byte-parity-with-the-pinned-install / serena-tools-list-byte-parity-with-the-pinned-install both true against the real pinned commit's installed output, not just the local synthetic test |
| ai-memory | 4 | all true |
| context-hub | 4 | all true (the AppArmor/unshare step added in this PR was exercised for real and worked) |
| agentsview | 3 | all true |
Second run, 36284521807 (commit aa40bf70, the Run.clean() fix): success, all steps green, 82/82 checks true again. receipt.json now contains the <UUID>/<HOME-EXAMPLE> placeholders — but a direct re-scan of the downloaded artifact still found two raw UUIDs, in state_observations["ai-memory-store"] specifically, which is Run.observe()'s output, a call site Run.clean()'s fix didn't reach — see finding 1's resolution column.
Third run, 36284916855 (commit 656faf02, the Run.observe() fix): success, all steps green, 82/82 checks true. This time a full re-scan of the downloaded artifact for both PRIVATE_CONTENT patterns found zero remaining raw UUID-shaped strings and zero remaining raw personal-home-path strings anywhere in receipt.json, with both redaction placeholders present — the finding is now fully closed against real, hosted, native execution, not just the local synthetic tests.
Token tools used, and why
ToolSearchonce, to load the deferred token-lane tools before first use.mcp__plugin_context-mode_context-mode__ctx_batch_execute/ctx_execute, repeatedly, to explorenative_token_ci.py's structure, review both diffs, and filter the downloadedreceipt.jsonfor UUID/home-path patterns — each call printed only the derived answer, never the raw file.WebSearchonce, to check whether GitHub's hostedubuntu-24.04runner already lifts Ubuntu 24.04's AppArmor unprivileged-userns restriction, since that was a live, checkable factual claim central to a correctness fix, not something to assume either way.Read/Editfor the small number of known-path, bounded reads this session judged the content of directly (source functions cited by name/line,scope.md, this comment).gh/gitnatively for PR, run, and artifact operations that need exact bytes or structured JSON (git diff --numstat,receipt.json), matching this repository's own guidance not to run those through a lossy rewrite.
Two GPT-6 (gpt-6-astra, max reasoning effort, live search) rounds did the actual code/test writing in a read/write sandbox with no git access: the initial build (9 tests + one IndexError fix) and this repair round (the Run.clean() fix + 5 tests). The review itself was a third, separate, read-only GPT-6 session.
…emory, context-hub, agentsview and an RTK exactness fix Replayed onto main c71d66d (after #364) through the hot-file protocol: the five PR files are unchanged; manifests/evidence.json is re-registered and the generated matrix and grand list are regenerated. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
656faf0 to
fbc3a88
Compare
Replayed onto main 881164e (after #364 and #375) with a 3-way squash: main had changed adoption/bootstrap.md, which merged cleanly; manifests/evidence.json was re-registered and the matrix and grand list regenerated. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…e and practice docs (fix plan steps 7-8) Replayed onto main 881164e (after #364 and #375) with a 3-way squash. Main had changed three of this PR's files: - The settings template and the macOS page merged cleanly; the template keeps #364's OTEL_METRICS_INCLUDE_SESSION_ID and this PR's 11 Read(**/...) twins. - adoption/bootstrap.md conflicted on one note: it keeps this PR's extended settings-template sentence, followed by #364's writer-identity paragraph. manifests/evidence.json was re-registered, and the matrix and grand list were regenerated. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Replayed onto main 881164e (after #364 and #375) with a 3-way squash: main had changed adoption/bootstrap.md, which merged cleanly; manifests/evidence.json was re-registered and the matrix and grand list regenerated. Co-authored-by: Scout <scout@local> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
…e and practice docs (fix plan steps 7-8) Replayed onto main 881164e (after #364 and #375) with a 3-way squash. Main had changed three of this PR's files: - The settings template and the macOS page merged cleanly; the template keeps #364's OTEL_METRICS_INCLUDE_SESSION_ID and this PR's 11 Read(**/...) twins. - adoption/bootstrap.md conflicted on one note: it keeps this PR's extended settings-template sentence, followed by #364's writer-identity paragraph. manifests/evidence.json was re-registered, and the matrix and grand list were regenerated. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…e and practice docs (fix plan steps 7-8) (#374) Replayed onto main 881164e (after #364 and #375) with a 3-way squash. Main had changed three of this PR's files: - The settings template and the macOS page merged cleanly; the template keeps #364's OTEL_METRICS_INCLUDE_SESSION_ID and this PR's 11 Read(**/...) twins. - adoption/bootstrap.md conflicted on one note: it keeps this PR's extended settings-template sentence, followed by #364's writer-identity paragraph. manifests/evidence.json was re-registered, and the matrix and grand list were regenerated. Co-authored-by: Scout <scout@local> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Summary
native-token-e2e.yml/Harden the last three workflows, pin exact release comments, and give native-token-e2e discriminating fixtures #370 did not reach:RTK's hook-check and exactness probes, context-mode (npm 1.0.169), Serena (commit
c6fbd1c5932df2494ffa0020af5a9fbe80b82143), ai-memory (2.4.1), context-hub (0.1.4) andagentsview (0.43.0), each with
run.check(...)assertions proving a correct response passesand a passthrough/unchanged/wrong response fails, per
docs/acceptance-evidence-policy.md'sdiscriminating-controls rule.
tests/test_native_token_ci.py, one per fixture/helper group(
rtk_hook_check_fixture+ the §4.1 negative controls,rtk_exactness_checks/rtk_exact_rows/rtk_exactness_fixture,context_mode_fixture,serena_fixture,ai_memory_fixture,context_hub_fixture,agentsview_fixture), following the file's ownestablished pattern (
test_headroom_fixture_requires_a_real_saving_and_exact_recovery,test_ast_grep_outcome_is_frozen_and_structural): mock boundary isrun.command(label-keyed) or
ci.mcp_stdio_session(Serena, ai-memory).rtk_exactness_checksindexed
lines(case, "rtk")[-1]unconditionally, so an empty RTK response raisedIndexErrorinstead of failing its named check. Fixed with a one-line
bool(lines(...))guard; confirmedred before (
IndexError,errors=3) and green after (OK).context_hub_fixture's own docstringsays "the workflow lifts" Ubuntu 24.04's AppArmor restriction on unprivileged user namespaces
before its
unshare -rncall, butnative-token-e2e.ymlhad no such step. GitHub's hostedubuntu-24.04runner image keeps that restriction by default(actions/runner-images#10443), so this
would otherwise fail "Operation not permitted" on every hosted run of the new fixture — not a
flake. One
run:step (sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0) afterharden-runner, which stays first.
Run.clean()— the sanitizerevery fixture's retained command/observation output already routes through — did not redact
two categories
scripts/validate.py's ownPRIVATE_CONTENTscanner defines: bare UUIDs andpersonal home paths. The real hosted run's artifact (linked in the PR comment) showed both,
from this PR's two new instances (ai-memory's own generated page/workspace path components;
an upstream example path in agentsview's
--helptext) plus a pre-existing instance frommarkitdown's ONNX dependency that this fix also now redacts.
Run.clean()now runs those twoPRIVATE_CONTENTpatterns (cited by name, not re-derived) as a regex pass after its existingliteral substitutions, with new tests proving the redaction, the
/home/exampleexemption,and no regression to the existing literal substitutions.
rather than trusting the second green run alone:
Run.observe()— used by six of this PR'sfixtures to record state-directory contents — built its returned path list directly, never
routing it through
clean(), so ai-memory's UUID-shaped page paths still leaked in the secondhosted run's artifact even after the fix above. Same one-line, same-source fix
(
self.clean(...)around the per-path expression), one more failing-first test (confirmedfailing by temporarily reverting the fix, not by inspection). Applied directly, not through a
second GPT-6 build round — the task's review/repair cycle is capped at one round, already used
above; this is a same-source extension of that already-reviewed fix to the one call site it
missed.
This PR's diff against
origin/mainisscripts/native_token_ci.pyandtests/test_native_token_ci.pyin full (git diff 34c56340 <head> --numstat) — it is notindependently separable into "pre-existing" and "added" parts once pushed, since the branch's
two local commits (a WIP checkpoint plus this round) were squashed into one commit by this
repository's hot-file rebase protocol before push. The bullets above describe what changed and
why; they do not claim the whole diff is one line.
Verification
Evidence class:
local_integration(each fixture runs the pinned tool's own CLI/MCP surface; thisrepository's checks assert on that output — see
Run.report["limits"]inscripts/native_token_ci.py). The new unit tests themselves aresynthetic(fixture-level):mocked subprocess/MCP boundaries proving the harness's own discriminators reject a
passthrough/wrong response.
Hosted
native-token-e2e.ymlrun36283215966
(triggered automatically by this PR's
pathsfilter):success, all steps green. Itsreceipt.json— downloaded and read directly, not inferred from the green checkmark — reportsstatus: "passed",failures: [], 82/82 checks true, including all 32 new checks and,critically,
serena-initialize-byte-parity-with-the-pinned-install/serena-tools-list-byte-parity-with-the-pinned-install= true against the real pinned commit'sinstalled output. Full table and the repair round's own hosted result are in the PR comment.
Residuals
exactness.shnamed in the plan's PR-CI row is a private scratch script from the 2026-09-26 RTKcoverage study (
full-save/rtk/exactness.sh), never committed; its checks are already portedinto
rtk_exactness_checks(comment already in the file cites this). No new shell script wasadded; adding one would duplicate committed logic with a second, divergent copy.
adoption/pins-linux-x86_64.jsonby design(
adoption_pin_mismatches's docstring: "Tools the adoption pins do not list are not compared");this PR does not add one, since that file's ownership is a separate lane.
Run.clean()fix redacts UUIDs and personal home paths for every fixture,including the pre-existing markitdown/ONNX instance — but it does not add a
validate.py --scan-filegate to the workflow itself, which would be a wider, cross-tool concern over all17 tools' artifacts (closer to the plan's separate evidence-sanitization lane) than this PR's
six tools. Flagging it as a follow-up, not fixing it here.
SOTA sources
manifests/stack.jsonandadoption/pins-linux-x86_64.json.rtk hook check --agent claudeis its own documented decisionpath; the five
exclude_commandsentries arefixtures/rtk-hook-exclusions.toml(recipes/README.md's four entries plus
jq, per rtk 0.50.0 hook recipe: exclude git show REV:path in every global-option form and git branch #318/PR-R's widening).installs the npm
[email protected]release (a distinct source revision from the nativeplugin pin, per recipes/README.md's own caveat) and calls its documented
ctx_doctorandctx_executeMCP tools through MCPorter's stack.json command form.c6fbd1c5932df2494ffa0020af5a9fbe80b82143(adoption/pins-linux-x86_64.json,recipes/README.md's serena row,
adoption/bootstrap.mdstep 4a). Its MCPinitialize/tools/listbehavior for theclaude-code/codexcontexts issrc/serena/resources/config/contexts/{claude-code,codex}.ymlat that commit.(
adoption/pins-linux-x86_64.json), its documentedinit/serve --transport stdioMCP surfaceand
memory_write_page/memory_query/memory_read_pagetools.its own
telemetry/feedbackopt-outs in$CHUB_DIR/config.yaml(config.js/telemetry.jsatthat version, cited in the fixture's docstring) and
CHUB_TELEMETRY/CHUB_FEEDBACKenvironmentoverrides.
(recipes/README.md's row),
--version/--helpandAGENTSVIEW_TELEMETRY_ENABLED.test_headroom_fixture_requires_a_real_saving_and_exact_recovery,test_ast_grep_outcome_is_frozen_and_structuralandtest_rtk_fixture_runs_the_upstream_inline_filter_testsintests/test_native_token_ci.py(unchanged by this PR) define the mock-boundary and
assertRaisesRegexidiom this PR's new testsfollow.
docs/acceptance-evidence-policy.md("Discriminatingcontrols" — a passing check counts as evidence only after the same check has been run with its
condition absent and failed).
scripts/validate.py'sPRIVATE_CONTENTtuple andscan_file_for_private_content(its docstring already anticipates exactly this situation: "agenerated artifact ... is invisible to that scan ... callers that publish a built artifact must
scan it explicitly ... before attesting/uploading it").
full-save/PLAN.md§3.1 PR-CI row, §4.1 (RTK negative-control table), §8finding 3 (scratchpad; not part of this repository).
🤖 Generated with Claude Code