test: repin ~70 assertions to the script contract — every literal gets a successor

Assertions that pinned inline-bash internals (update-check guard, _SESSIONS
reaping, telemetry start/end blocks, routing probe, repo-strip producer,
first-task gating, EXPLAIN_LEVEL/QUESTION_TUNING echoes, #2499 jq scope
resolution, Issue-8 CONDUCTOR gate) now pin the same invariants in their new
home: bin/gstack-skill-start / bin/gstack-skill-end file content for script
internals, the invocation fence + interpretation prose for render-side
behavior. No assertion deleted without a successor; live-execution tests
(routing probe, brain-sync jq) run against script bytes unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-25 15:37:00 +00:00
co-authored by Claude Fable 5
parent eb1607aaf8
commit 17bebe33ab
9 changed files with 280 additions and 109 deletions
+18 -6
View File
@@ -71,12 +71,24 @@ describe('Preamble composition order', () => {
});
});
describe('Conductor signal (preamble bash)', () => {
test('claude preamble emits CONDUCTOR_SESSION, gated on != headless (Issue 8)', () => {
describe('Conductor signal (skill-start script)', () => {
// Token-reduction Phase 1 moved the preamble bash into bin/gstack-skill-start;
// the Issue-8 invariant (CONDUCTOR_SESSION emitted, gated on != headless so
// eval/CI inside Conductor BLOCKs instead of rendering prose to nobody)
// lives in the script now. The render must still invoke the script and the
// AUQ prose still branches on the echoed line.
test('skill-start script emits CONDUCTOR_SESSION, gated on != headless (Issue 8)', () => {
const fs = require('fs');
const path = require('path');
const script = fs.readFileSync(path.join(import.meta.dir, '..', 'bin', 'gstack-skill-start'), 'utf-8');
expect(script).toContain('echo "CONDUCTOR_SESSION: true"');
expect(script).toMatch(/"\$_SESSION_KIND" != "headless"[\s\S]*CONDUCTOR_WORKSPACE_PATH[\s\S]*CONDUCTOR_PORT[\s\S]*CONDUCTOR_SESSION: true/);
});
test('claude preamble render invokes the script and interprets CONDUCTOR_SESSION', () => {
const out = generatePreamble(makeCtx('claude', 2, 'claude'));
expect(out).toContain('echo "CONDUCTOR_SESSION: true"');
// The emission must be suppressed when the session is headless (eval/CI
// inside Conductor must BLOCK, not render prose to nobody).
expect(out).toMatch(/"\$_SESSION_KIND" != "headless"[\s\S]*CONDUCTOR_WORKSPACE_PATH[\s\S]*CONDUCTOR_PORT[\s\S]*CONDUCTOR_SESSION: true/);
expect(out).toContain('gstack-skill-start');
// The AUQ tool-resolution prose keys off the echoed line.
expect(out).toContain('CONDUCTOR_SESSION: true');
});
});