Skip to content

feat(brief): find the origin of an error message the question describes without quoting it - #1210

Merged
navidemad merged 12 commits into
mainfrom
brief/1197-error-origin
Oct 18, 2026
Merged

navidemad merged 12 commits into
mainfrom
brief/1197-error-origin

Conversation

@navidemad

@navidemad navidemad commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1197

Stack (L7, #906): #1208 (#1201 harness) ← #1209 (#1196 test bodies) ← this PR (#1197). Base: brief/1196-test-bodies. GitHub links Closes #1197 only once the PR targets main.

Summary

error-origin already existed, but it ran only when the prompt quoted the message, and none of the seven error-origin questions of the public bench quotes one ("where does the runtime error about working outside of application context come from"). The probe now also finds a message described in words: the short string literal that carries the most of the prompt's words. From there it is the same flow as before: the raising function, its callers over two levels, one test.

 origins(prompt)
   quoted message -> locate()                                   (unchanged)
+  else described():
+    words of the prompt, each weighed by log(lines / lines carrying it)          (no word list)
+    seed lines = the 4 rarest words; candidate = the whole string around the hit
+      (Python triple quotes, JS template, Rust "\"-continued); longer than ±8 lines -> a manual, skipped
+    shared = words in the string + in what emits it (enclosing fn, call above: eprint_nothing_searched, err_message!)
+    rank: more shared words, then IDF / log2(4 + string tokens); words of ≤3 letters must equal a token
+    JSON catalogue entry -> the code that names its key
+  manifest: when_prompt also matches error/exception/message/warning/alert/panic/text (0.1.0 -> 0.2.0)

Evidence

  • Before → after, frozen-probe harness, same binary (main 7887b9e6). Probes frozen at 77f565ba (brief: quote the bodies of the tests that exercise the target (tests oracle 2%) #1196) vs fce305a2, so this probe is the only change:

    python3 -I scripts/bench/tool-census/score_brief.py pinned --base <pixel @7887b9e6> \
      --probe-commit 77f565ba --head-probe-commit fce305a2 --label ab-1197 --root /tmp/pixel-906-baseline
    before after
    error-origin file_recall 0.186 0.244
    error-origin line coverage / region_cov 9.0 % / 0.044 11.3 % / 0.050
    all: file_recall / region_cov 0.420 / 0.087 0.427 / 0.088

    50/56 briefs identical, no category or session worse. Origins found: ripgrep crates/core/main.rs:424 in eprint_nothing_searched; flask src/flask/globals.py:34 (the _no_app_msg text); fd src/cli.rs; requests src/requests/adapters.py:204; excalidraw App.tsx. express-07 gets nothing: "Cannot GET" lives in a dependency, not in the repository.

  • Prototype iterations (scratchpad, offline on the saved hook briefs), kept or dropped. The first cut excluded words on more than 400 lines: file/search vanished on ripgrep, so it was dropped for IDF weighting. Ranking by IDF sum chose a manual page over the message: dropped for whole-string spans, the ±8-line manual cutoff and the emitter's words. A 2-letter prefix (no in not) inflated a doc string: words of 3 letters or fewer now must equal a token. A context-only match picked an import line: dropped, the string itself must carry one word.

  • Tests that fail without the change. probes/error-origin/tests/test_probe.py (5 cases: an emitted message beats a manual sharing more words, a Python triple-quoted message, a catalogue key followed to code, a doc-length string never chosen, an inline test module skipped). Against the previous probe:

    FAIL: test_a_catalogue_entry_is_followed_to_the_code_that_names_its_key
    FAIL: test_a_python_message_in_triple_quotes_is_found_on_its_own_line
    FAIL: test_the_emitted_message_beats_a_manual_that_shares_more_words
    FAILED (failures=3)
    

    The two others guard against false origins, so they pass on the old probe too. CI now installs ripgrep before the probes' own tests, which need it.

  • probe-test.py error-origin: … | coverage 5% -> 6% | OK. --guard passes on the 7 error-origin prompts with their oracle paths: the old docstring's triggers and cannot were reworded, and they would have failed it too. --check-all: ok.

  • Not run: the live Codex A/B. The call replay predicts 24 → 24 (it cannot credit quoted ranges).

Merge Danger

Door: one-way for installs: pixel setup rewrites ~/.pixel/plugins/error-origin/ on its next run. A revert ships the old copy back on the run after.

Blast radius: low to medium. The probe now runs on any prompt naming an error, message, warning, alert, panic or text: 9/56 bench prompts, 2 of them outside error-origin, with no session worse. It costs up to 7 rg calls inside its 2 s budget, fails open, and appends.

Docs touched

.github/changelog.d/error-origin-described.changed.md, docs/bench/brief-public-acceptance-2026-10-17/README.md (pack table), .github/workflows/ci.yml (ripgrep for probe tests). ARCHITECTURE.md: unchanged, since the probe count and the shipped set's description are the same.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…dget

score_brief.py gains freeze-home (the probes a binary built at a commit
embeds, hashed), --probe-home, and pinned (two binaries or two probe sets
on frozen homes, then compare). report.json records the probe identity,
the route and the question SHA-256; compare flags runs that differ in more
than one input. The default route is now the prompt-submit hook's
brief-only payload (3 s window, probe floor, all parts): the brief command
gave probes 750 ms and no floor, and config-registry timed out on one run
and not the next.

Refs #906
A test-bodies probe (append, kind tests or a prompt naming tests) quotes
the test cases whose name or body carries the prompt's subject: Python
def test_*, JS it/test, Rust fn under #[test] including inline modules.
Candidates are the test files the brief names, then those whose path
names the subject; word weights come from how many cases carry a word,
not from a word list. Registered in bundled_probes.rs; the install tests
derive their counts from the allowlist.

Closes #1196
…es without quoting it

error-origin ran only on a quoted message, and none of the seven
error-origin questions of the public bench quotes one. It now also takes
the short string literal that carries the most of the prompt's words,
each weighed by how few source lines carry it, with the call and function
that emit the string counted beside it. A string longer than the window
is a manual, not a message; a JSON catalogue entry is followed to the
code that names its key; inline test modules are skipped. CI installs
ripgrep for the probes' own tests.

Closes #1197
A run on daemons left in the clones by pixel calls outside the harness
answered 7 of 56 briefs differently from its two replays (an op left
unanswered, flow-rank empty). activate now stops the clone's daemon
before prepare-repo, so every run is served by a daemon it started.

Refs #1201
@navidemad
navidemad changed the base branch from brief/1196-test-bodies to main October 18, 2026 17:00
# Conflicts:
#	docs/bench/brief-public-acceptance-2026-10-17/README.md
Comment thread probes/error-origin/probe Fixed
CodeQL flagged string_part's pattern: an escape and a plain character
could both match a backslash, so an unclosed string of escapes
backtracked exponentially (the new test hit a 20 s timeout before the
fix, under 1 s after). A plain character now excludes the backslash.

Refs #1197
@navidemad
navidemad merged commit 7a8a878 into main Oct 18, 2026
14 checks passed
@navidemad
navidemad deleted the brief/1197-error-origin branch October 18, 2026 17:22
LivioGama pushed a commit that referenced this pull request Nov 25, 2026
…es without quoting it (#1210)

* chore(bench): freeze the probe home and score briefs on the hook's budget

score_brief.py gains freeze-home (the probes a binary built at a commit
embeds, hashed), --probe-home, and pinned (two binaries or two probe sets
on frozen homes, then compare). report.json records the probe identity,
the route and the question SHA-256; compare flags runs that differ in more
than one input. The default route is now the prompt-submit hook's
brief-only payload (3 s window, probe floor, all parts): the brief command
gave probes 750 ms and no floor, and config-registry timed out on one run
and not the next.

Refs #906

* feat(brief): quote the bodies of the tests a tests question asks about

A test-bodies probe (append, kind tests or a prompt naming tests) quotes
the test cases whose name or body carries the prompt's subject: Python
def test_*, JS it/test, Rust fn under #[test] including inline modules.
Candidates are the test files the brief names, then those whose path
names the subject; word weights come from how many cases carry a word,
not from a word list. Registered in bundled_probes.rs; the install tests
derive their counts from the allowlist.

Closes #1196

* docs(bench): record the test-bodies pack on the frozen-probe harness

Refs #1196

* feat(brief): find the origin of an error message the question describes without quoting it

error-origin ran only on a quoted message, and none of the seven
error-origin questions of the public bench quotes one. It now also takes
the short string literal that carries the most of the prompt's words,
each weighed by how few source lines carry it, with the call and function
that emit the string counted beside it. A string longer than the window
is a manual, not a message; a JSON catalogue entry is followed to the
code that names its key; inline test modules are skipped. CI installs
ripgrep for the probes' own tests.

Closes #1197

* docs(bench): record the error-origin pack on the frozen-probe harness

Refs #1197

* chore(bench): stop a clone's leftover daemon before scoring on it

A run on daemons left in the clones by pixel calls outside the harness
answered 7 of 56 briefs differently from its two replays (an op left
unanswered, flow-rank empty). activate now stops the clone's daemon
before prepare-repo, so every run is served by a daemon it started.

Refs #1201

* test(setup): list the test-bodies probe in the setup goldens and agents data

Refs #1196

* fix(brief): read string literals in linear time in error-origin

CodeQL flagged string_part's pattern: an escape and a plain character
could both match a backslash, so an unclosed string of escapes
backtracked exponentially (the new test hit a 20 s timeout before the
fix, under 1 s after). A plain character now excludes the backslash.

Refs #1197
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.

brief: error-origin pack — raise sites and callers of a quoted error (file_recall 15%)

2 participants