fix(runner): stream --ids sources and cap selection to the pinned set - #47
fix(runner): stream --ids sources and cap selection to the pinned set#47SebTardif wants to merge 2 commits into
Conversation
PLAN: HTTP and file --ids loaders used unbounded ReadAll. PR 45 capped HTTP at 256 KiB, which rejects the valid 1.3 MiB full SkillTrustBench JSONL list and left local files unbounded. DO: stream both sources through the existing line parser and reject more than 5520 unique IDs, the pinned SkillTrustBench full set. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 28, 2026, 12:36 AM ET / 04:36 UTC. ClawSweeper reviewWhat this changesThis PR streams SkillTrustBench Merge readinessKeep open: current main still fully buffers Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherThe benchmark command reads an optional ID list before the SkillTrustBench adapter fetches benchmark rows and scans selected cases. This loader controls memory use and determines which IDs reach the benchmark runner. flowchart LR
A[Benchmark command] --> B[File or HTTP ID source]
B --> C[Streaming ID loader]
C --> D[ID validation and limits]
D --> E[Pinned SkillTrustBench rows]
E --> F[Selected case scans]
F --> G[Benchmark artifact]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep the streaming implementation and document all three semantic limits consistently in the benchmark docs and CLI skill, while explicitly preserving that JSONL source size itself is not capped. Do we have a high-confidence way to reproduce the issue? Yes, at source level: fetched current main fully buffers both local and HTTP Is this the best way to solve the issue? No, not quite: streaming through the existing parser with retained-ID bounds is the narrow maintainable repair, but the public contract must also disclose both newly enforced byte limits. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f3ac276393cd. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (35 earlier review cycles; latest 8 shown)
|
The 5,520-id cap ran after each extracted id was stored. A hostile HTTP source could still retain thousands of unique megabyte-sized ids. Cap one id at 256 bytes and retained id text at 256 KiB. That still accepts the documented SkillTrustBench set. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Pushed @clawsweeper re-review |
Refreshed the PR body with public CLI output from @clawsweeper re-review |
What Problem This Solves
Fixes an issue where
clawscan benchmark --idscould exhaust memory.readBenchmarkIDSourcedid an unboundedio.ReadAllon HTTP sources (andos.ReadFileon local files). Follow-up to #45, which @steipete closed: a 256 KiB HTTP-only cap would reject the documented full SkillTrustBench ID list (5,520 cases, about 1.3 MiB of canonical JSONL) and left files unbounded.The first head still kept every parsed id in memory up to the 5,520-count cap. A hostile source can send 5,520 unique records that are each far larger than a real case id. This tip also caps one extracted id at 256 bytes and retained id text at 256 KiB. Those are not JSONL file-size limits, so the documented 5,520-id / 1.3 MiB SkillTrustBench stream still parses.
Why This Change Was Made
Stream file and HTTP
--idssources through the same line parser. Bound the selection by case count (5,520 unique IDs, the pinned SkillTrustBench full set), one-id length (256 bytes), and retained id text (256 KiB). Do not copy the 256 KiB plugin-manifest limit onto the JSONL stream.User Impact
A hostile or accidental multi-gigabyte
--idsURL no longer has to be fully buffered. A valid full-set JSONL list still loads. More than 5,520 unique IDs, a single id longer than 256 bytes, or more than 256 KiB of retained id text is rejected before the benchmark run starts.Evidence
Terminal output from the public CLI built at
6baa16f. Selection load rejects the new retained-id bounds and still accepts a 299600-byte JSONL file (larger than 256 KiB):A 400-row JSONL fixture (299600 bytes) loads from a file. The CLI then looks up selected ids in SkillTrustBench, which proves selection finished and the 256 KiB stream cap is not applied:
The same 400-id selection also loads from HTTP (
loaded count=400, matching sha256835384f6bb8da14b7a7db4cdf6fc1c844331eaa3a05244064f9351b58d69e1bb).make docs-siteon this tree:Built 7 docs page(s) in dist/docs-site. Generateddist/was not committed.Real behavior proof
Behavior or issue addressed:
--idsno longer does an unbounded full-body read. One extracted id is capped at 256 bytes and retained id text at 256 KiB. A valid JSONL list larger than 256 KiB still loads.Real environment tested: macOS, Go toolchain, branch fix/ids-stream-semantic-bound at
6baa16f, public CLI binary/tmp/clawscan-47built from that tree.Exact steps or command run after this patch:
python3 -c "from pathlib import Path; Path('/tmp/clawscan-huge-id.txt').write_text('a'*257+'\n')" /tmp/clawscan-47 benchmark SkillTrustBench --ids /tmp/clawscan-huge-id.txt --scanner clawscan-static --output /tmp/clawscan-ids-out.json /tmp/clawscan-47 benchmark SkillTrustBench --ids /tmp/clawscan-agg-ids.txt --scanner clawscan-static --output /tmp/clawscan-ids-out.json /tmp/clawscan-47 benchmark SkillTrustBench --ids /tmp/clawscan-too-many-ids.txt --scanner clawscan-static --output /tmp/clawscan-ids-out.json /tmp/clawscan-47 benchmark SkillTrustBench --ids /tmp/clawscan-large-ids.jsonl --scanner clawscan-static --output /tmp/clawscan-large-out.jsonEvidence after fix: terminal output from the public CLI on
6baa16f:Observed result after fix: The CLI exits 1 at selection load for a 257-byte id, for 2000 retained ids over the 262144-byte budget, and for 5521 ids. A 299600-byte JSONL source is accepted and the next error is a missing SkillTrustBench row, not a stream-size reject. Hugging Face row fetch is not started on the reject paths.
What was not tested: A live Hugging Face
--idsURL for the full 5,520-row JSONL (about 1.3 MiB). Coverage for that size class is the 400-row file and HTTP fixture (299600 bytes).Summary
--idsfile and HTTP sources; cap unique IDs at the pinned SkillTrustBench set size; cap one id at 256 bytes and retained id text at 256 KiB.ReadAll/ReadFilecan exhaust memory; a 256 KiB HTTP file-size cap rejects valid documented input; a count-only cap still lets 5,520 huge records stay in memory.Scope
Security / Trust Impact
Unbounded remote
--idsbodies are no longer fully buffered. Limits are the SkillTrustBench case count, a 256-byte per-id cap, and a 256 KiB retained-id-text budget, documented indocs/benchmarks.md.Verification
make docs-site) orN/A:Built 7 docs page(s) in dist/docs-site(generateddist/not committed)Ref #45