Skip to content

/cso searches the whole repository in one call with a hard time limit (GST-3588) - #4742

Merged
capy-ai[bot] merged 3 commits into
mainfrom
cso-search-with-a-time-limit
Nov 23, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
cso-search-with-a-time-limit

Conversation

@garrytan

@garrytan garrytan commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

/cso can now search every file in a repository with one helper call, which stops at a hard time limit, and a daily report.md lists its low-confidence hypotheses.
Why: audits that started never reached the vulnerable file because each file took its own helper call inside a 10-minute budget (gstack-evals#443).
Nothing to do: the next /cso run uses it.

What changed
  • gstack-cso search <run> <regex> [--seconds N]. It checks the snapshot once and runs one regular expression over every readable file. It prints path:line:text with the text around the match. It reads only the helper's redacted copy and skips paths outside --paths. The pattern is capped at 512 characters and the output at 96 KiB.
  • A hard time limit. Matching runs in a worker, one 4 KiB window of a line at a time, so a long minified line stays fast. The limit (60 seconds, or --seconds from 1 to 60) starts before any file is read; the snapshot check before the first file cannot be interrupted, and the 64 MiB snapshot cap bounds it. The helper stops the worker at the limit, even inside one runaway match, keeps the hits it has received (including earlier hits in the file it was on; one still in flight at the limit can be lost), and lists the files it did not finish: the first 50 by name, then a count.
  • Honest gaps. Files over 1 MiB or unreadable are listed as a coverage gap. Files the snapshot deliberately left out (dependencies, nested repositories, binaries, symlinks) go on a separate count line that points to inspect, so they no longer look like a gap. Files with lines over 4096 characters are named, because ^, $, lookbehind and matches over 256 characters are approximate there.
  • Paged file list. The skill reads the jq file list 500 paths at a time instead of in one shell result, and its source-access rule now names search beside inspect, read and history.
  • Daily hypotheses in report.md. report.md now lists a daily run's hypotheses under "Hypotheses (unconfirmed)", the section the shared renderer already writes for comprehensive runs. Text such as $' in a hypothesis is copied literally. lib/cso/contracts.ts is unchanged, so the runtime images need no requalification.
Tests
  • test/cso-recall.test.ts: 6 pass. Its search tests cover hits, a hostile file name that is never run, an over-1-MiB file listed as unsearched, a dependency file kept off the gap line, a match past column 300, the long-line note, no matches, an invalid pattern and a bad --seconds. A one-line 1 MiB file finishes a quadratic pattern, and a runaway pattern stops at its 2-second limit with the hit before it in the same file kept. The daily-report test checks the hypotheses section with $' and $& in a title.
  • The tests added in the review round fail on the first head (ba138f2) and pass here; the first head's new tests failed on main.
  • Free test suite in CI at this tree (run 45181717166): 1776 test files, 0 failures. The macOS and Windows launcher jobs, macos-named-regressions and windows-smoke pass at this head.
  • typecheck, typecheck:test, format:cso:check, /cso helper suites, skill validation, parity, size and budget guards: pass
Review

Two full rounds ran (specialists, red team, a native adversarial pass and a second-model review). In the second round the second-model reply was collected by hand after a resend, so its record is incomplete; see the Agent notes. The first round's 14 findings were all fixed. The second round found no defect that fails a test, breaks production or loses data or secrets. Its seven items marked blocking were ruled below that bar and ship as notes, listed in the Agent notes: the time limit cannot interrupt snapshot validation (bounded by the 64 MiB cap), the unfinished list names 50 files then a count, CRLF and trailing-newline line handling and \b at window edges, and the worker posting hits after the output budget is full. Other notes kept: a stop notice can be cut off when a pipe reader stalls for seconds; hits queued just before the limit can be dropped while the file is still listed as unsearched; "${@:3}" in the build script passed the macOS CI job; two further red-team notes are recorded privately.

Documentation

Status: current. No documentation edits were needed.

Scope: base af6deb9 to HEAD ca1222f on cso-search-with-a-time-limit, 9 selected files (the gstack-cso search command, its search worker, daily hypotheses in report.md, the build script, tests, the /cso skill template and its generated SKILL.md, and a changelog fragment), plus an unstaged edit to the changelog fragment.

Documentation health:

  • cso/SKILL.md.tmpl: current. It covers search, the 60-second limit, the 500-path paging and the hypotheses line.
  • cso/SKILL.md: current and matches the template.
  • changelog.d/cso-search-with-a-time-limit.md: current; it matches the 50-path listing in the code. This audit doesn't edit changelog files.
  • docs/skills.md: current. The /cso section doesn't list helper subcommands.
  • docs/cso-release-qualification.md: current. How hypotheses are scored is unchanged.

Coverage debt: gstack-cso search has reference coverage only (SKILL.md and the CLI usage text). Nothing explains how to use it or why it exists, which is a common gap. The hypotheses section in daily report.md has the same reference-only coverage.

Diagram drift: none. No diagrams reference the changed modules.

Agent notes

Refs GST-3588, gstack-evals#443. Follow-up to #4739 under the GStack Minder split ruling.

Approvals

Approved: yes (record r-0a5b0f0be688). The full approval record stays private.
Plan: exempt: bug fix with failing-first tests (R65)
Plan check: exempt bug fix

Ruled note: lib/cso/search-worker.ts:16:testing at ca1222f ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY) at 2026-11-23T13:09:40.245Z: CRLF lines keep their CR and a trailing newline counts as an empty line; a recall note, ships as a note (A) (approval a-229bafe8cc0e)
Ruled note: lib/cso/cli.ts:1690:testing at ca1222f ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY) at 2026-11-23T13:09:40.364Z: the time limit cannot interrupt snapshot validation, which the 64 MiB cap bounds; unsearched files are still listed (A) (approval a-7273dec3d5f0)
Ruled note: lib/cso/cli.ts:1668:testing at ca1222f ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY) at 2026-11-23T13:09:40.518Z: the unfinished-files list names 50 paths plus a count; ships as a note (A) (approval a-7d63fa062a5f)
Ruled note: lib/cso/search-worker.ts:19:outside-voice at ca1222f ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY) at 2026-11-23T13:09:40.645Z: window edges can change \b and CRLF results; a recall note, ships as a note (A) (approval a-8bfb77806727)
Ruled note: lib/cso/search-worker.ts:22:outside-voice at ca1222f ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY) at 2026-11-23T13:09:40.734Z: the worker keeps posting hits after the output budget is full, costing time and memory, not output (A) (approval a-7677c9ee0579)
Ruled note: lib/cso/cli.ts:1690:outside-voice at ca1222f ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY) at 2026-11-23T13:09:40.824Z: the time limit cannot interrupt snapshot validation, which the 64 MiB cap bounds; unsearched files are still listed (A) (approval a-b7a6d9d4ed4a)
Ruled note: lib/cso/cli.ts:1667:outside-voice at ca1222f ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY) at 2026-11-23T13:09:40.910Z: the unfinished-files list names 50 paths plus a count and has no resume; ships as a note (A) (approval a-1ecd735f79a2)

Review bookkeeping: the round-2 second-model reply was collected under the wrong reader name after a lane note interrupted it, so gstack-review-dispatch verify reports p2 dirty (outside-voice/outside-voice#2 MISMATCH beside the unavailable outside-voice@2 record). Its findings are in merged.jsonl and the review-log rows, and gstack-review-scope summary counts both passes.

{
  "schema_version": 1,
  "pr": 4742,
  "head": "f8efb519f3a12703cf90e7dcbd605089df74c896",
  "version": "1.103.0.0",
  "base": "main",
  "gate": {
    "free": {
      "pass": 1776,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 45181717166,
      "attempt": 1,
      "tree": "68e05fd7a797bc23dda9ee0454ba53582bbfd83c"
    }
  ],
  "calls": 118,
  "session_kind": "unattended",
  "run": "/home/user/.capy/work/ship-search",
  "head_tree": "68e05fd7a797bc23dda9ee0454ba53582bbfd83c",
  "product_patch_id": "eef528e2a0c86a3a679030a35f7e8b093871961e",
  "gstack_version": "1.103.0.0",
  "review_depth": {
    "depth": "full",
    "class": "code",
    "runtime_lines": 182,
    "rules": "33831f8248a814fd",
    "base": "45b48f17d9282442bc1321bc2ba9ffbf037195f3",
    "registry": "45b48f17d9282442bc1321bc2ba9ffbf037195f3",
    "gate_scan": {
      "tagged": 0,
      "head": "f8efb519f3a12703cf90e7dcbd605089df74c896"
    },
    "reasons": [
      "risk:security",
      "runtime=182"
    ],
    "risk": [
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @68e05fd7a797 (8 checks, current for f8efb519f3a1)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/45181717166/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/45181717166/attempts/1",
    "free-tests.yml/cso-windows-launcher: https://github.com/garrytan/gstack/actions/runs/45181717166/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/45181716972/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=68e05fd7a797 tests=39239 skipped=104 runs=45181717166/1 profiles=ci-reuse/free-tests heads=f8efb519f3a1 base_moved=45b48f17d928 verified=2026-11-23T13:35:07.272Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "README.md, docs/, cso/SKILL.md(.tmpl), changelog.d fragment for the search change"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 11,
    "deferred": 0,
    "noted": 11,
    "fixed": 14,
    "scope": "unknown",
    "rounds": 2,
    "ledgers_read": 3,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  },
  "ruled_notes": [
    {
      "finding": "lib/cso/search-worker.ts:16:testing",
      "head": "ca1222f8483435c7c7e0a7de02f2d78e4beaacea",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "CRLF lines keep their CR and a trailing newline counts as an empty line; a recall note, ships as a note (A)",
      "at": "2026-11-23T13:09:40.245Z",
      "approval": "a-229bafe8cc0e",
      "relayed": "GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY"
    },
    {
      "finding": "lib/cso/cli.ts:1690:testing",
      "head": "ca1222f8483435c7c7e0a7de02f2d78e4beaacea",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "the time limit cannot interrupt snapshot validation, which the 64 MiB cap bounds; unsearched files are still listed (A)",
      "at": "2026-11-23T13:09:40.364Z",
      "approval": "a-7273dec3d5f0",
      "relayed": "GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY"
    },
    {
      "finding": "lib/cso/cli.ts:1668:testing",
      "head": "ca1222f8483435c7c7e0a7de02f2d78e4beaacea",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "the unfinished-files list names 50 paths plus a count; ships as a note (A)",
      "at": "2026-11-23T13:09:40.518Z",
      "approval": "a-7d63fa062a5f",
      "relayed": "GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY"
    },
    {
      "finding": "lib/cso/search-worker.ts:19:outside-voice",
      "head": "ca1222f8483435c7c7e0a7de02f2d78e4beaacea",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "window edges can change \\\\b and CRLF results; a recall note, ships as a note (A)",
      "at": "2026-11-23T13:09:40.645Z",
      "approval": "a-8bfb77806727",
      "relayed": "GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY"
    },
    {
      "finding": "lib/cso/search-worker.ts:22:outside-voice",
      "head": "ca1222f8483435c7c7e0a7de02f2d78e4beaacea",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "the worker keeps posting hits after the output budget is full, costing time and memory, not output (A)",
      "at": "2026-11-23T13:09:40.734Z",
      "approval": "a-7677c9ee0579",
      "relayed": "GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY"
    },
    {
      "finding": "lib/cso/cli.ts:1690:outside-voice",
      "head": "ca1222f8483435c7c7e0a7de02f2d78e4beaacea",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "the time limit cannot interrupt snapshot validation, which the 64 MiB cap bounds; unsearched files are still listed (A)",
      "at": "2026-11-23T13:09:40.824Z",
      "approval": "a-b7a6d9d4ed4a",
      "relayed": "GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY"
    },
    {
      "finding": "lib/cso/cli.ts:1667:outside-voice",
      "head": "ca1222f8483435c7c7e0a7de02f2d78e4beaacea",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "the unfinished-files list names 50 paths plus a count and has no resume; ships as a note (A)",
      "at": "2026-11-23T13:09:40.910Z",
      "approval": "a-1ecd735f79a2",
      "relayed": "GSTA-823:01M848CVTE9XDZ3DB6WHA43ZHY"
    }
  ],
  "gate_dispositions": []
}

gstack-cso search runs one regular expression over every readable snapshot file in a worker the helper kills at 60 seconds, prints the hits found so far and names unsearched files as a coverage gap. The skill pages the file list, and a daily report.md lists its hypotheses.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 23, 2026 12:40
…ed files a gap

The time limit now covers reading files, a stopped search keeps the matches it
found in the file it was on, files the snapshot deliberately left out are no
longer listed as a coverage gap, long lines say they were matched in windows,
and $ sequences in a hypothesis no longer rewrite the daily report.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot marked this pull request as ready for review November 23, 2026 13:36
@capy-ai
capy-ai Bot merged commit a3ecfd5 into main Nov 23, 2026
76 of 77 checks passed
@garrytan garrytan mentioned this pull request Nov 24, 2026
capy-ai Bot added a commit that referenced this pull request Nov 24, 2026
- `/ship` now tells you what to change when GitHub refuses a push for email privacy. (#4748)
- The release gate's /cso check accepts the low-confidence hypotheses /cso now reports. (#4753)
- /cso reports every security finding the code supports instead of dropping most of them. (#4739)
- /cso can search the whole repository in one call, and a daily report now lists its low-confidence hypotheses. (#4742)
- A first version's plan and try-it message now open with the owner's own words, and the build is tried the same way he will try it before he is asked. (#4759)
- A first version's public export now keeps out the owner's short quotes and his reasons to leave something out, and a phone first-use check installs a build the cloud phone can actually run. (#4772)
- Three intermittent test failures are fixed. (#4745)
- Free Tests runs its shards on 8-core runners again. (#4749)
- A land that waits on an earlier CI run now decides on what that run actually did. (#4763)
- Landing a PR no longer starts a new CI run when one for the same merged code is already running or has passed. (#4760)
- /ship no longer misses a file-mode change from main on files whose names start with `:`. (#4774)
- make-pdf keeps quotes in alt text, link titles and raw HTML attributes inside the attribute, so a Markdown file can no longer add an `onerror`, `onload` or `javascript:` link that runs in the print browser. (#4761)
- Posting a PR body that lists earlier /ship runs no longer stops for a phone number that isn't there. (#4747)
- A first version's public export now catches a short owner quote whose padding or quote marks are encoded. (#4778)
- A first version's public export now also keeps out a short owner quote written with spaces just inside its quote marks. (#4776)
- Posting a PR body that lists earlier /ship runs no longer stops for a card number that isn't there. (#4751)
- /ship no longer asks for an extra reader when you merge the base branch next to code that was already reviewed. (#4754)
- /ship no longer plans narrow re-checks after a fix. (#4741)
- /ship can't quietly gain new refusals. (#4740)
- `gstack-upgrade` no longer refuses to run after you disable skills. (#4743)
- The free test suite splits its shards from this week's recorded test times. (#4744)
- gstack now writes up a failed or shelved attempt before closing it. (#4735)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
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