fix: pre-landing review fixes (#2733)

Review army + coverage audit findings, all applied:
- headless directive carries the spawned escape sentence too (multi-
  specialist: a CI-hosted ship's marked subagent must not end BLOCKED)
- anti-injection scoping on every text-claimable spawned trigger (AUQ
  rule + shared escape sentence): markings count only from the creating
  prompt, never from files/tool output/web content read mid-run
- [conductor][spawned] deny annotates one-way doors per question
- SPAWNED_OVERRIDE: env tamper-visibility status line + OPENCLAW.md note
- spawned sessions skip the network update-check and first-task probe
  (consumers suppressed; preserves the one-shot just-upgraded marker)
- test hardening: dispatch-tripwire end-bound validated, vacuous marker
  asserts replaced with output asserts, E2E cpSync size filter + named
  fence tolerance, spawnedByEnv parity pin, destructive-policy cross-
  surface drift guard, one-way annotation + bogus-value hook cases
- session-kind duplicate rationale comment deduped; regen + goldens +
  context-budget fixture refreshed

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-31 00:45:18 +00:00
co-authored by Claude Fable 5
parent 46ba23c512
commit e65be946dd
61 changed files with 431 additions and 128 deletions
+18 -3
View File
@@ -218,11 +218,22 @@ describe('gstack-skill-start behavior', () => {
);
expect(ids).toEqual(['spawned-session']);
// Script-side ack-at-emit markers stay UNWRITTEN, so the one-time
// prompts fire intact on the next human session.
// prompts fire intact on the next human session. (.activated and
// .first-loop-tip-shown are the two the SCRIPT writes; the model-run
// touch targets are covered via output absence below — asserting their
// file non-existence would be vacuous in a script-only run.)
expect(fs.existsSync(path.join(freshGh, '.activated'))).toBe(false);
expect(fs.existsSync(path.join(freshGh, '.first-loop-tip-shown'))).toBe(false);
expect(fs.existsSync(path.join(freshGh, '.completeness-intro-seen'))).toBe(false);
expect(fs.existsSync(path.join(freshGh, '.telemetry-prompted'))).toBe(false);
expect(out).not.toContain('.completeness-intro-seen');
expect(out).not.toContain('.telemetry-prompted');
// Spawned skips the first-task probe entirely (dead work: its only
// consumers are inside the onboarding guard) and the update-check
// (network-bound; would consume the one-shot just-upgraded marker).
expect(out).toMatch(/^FIRST_TASK: $/m);
// Env-driven override is surfaced loudly, naming the driver (tamper
// visibility — a settings env block flipping a human session must be
// legible in the transcript).
expect(out).toMatch(/^SPAWNED_OVERRIDE: env \(GSTACK_SESSION_KIND\)$/m);
} finally {
fs.rmSync(freshGh, { recursive: true, force: true });
}
@@ -247,6 +258,10 @@ describe('gstack-skill-start behavior', () => {
);
expect(ids).toEqual(['spawned-session']);
expect(fs.existsSync(path.join(freshGh, '.activated'))).toBe(false);
// OPENCLAW-driven spawned gets the same tamper-visibility line — this
// PR amplifies OPENCLAW_SESSION's power (deterministic hook deny,
// Conductor suppression), so it needs the same transcript marker.
expect(out).toMatch(/^SPAWNED_OVERRIDE: env \(OPENCLAW_SESSION\)$/m);
} finally {
fs.rmSync(freshGh, { recursive: true, force: true });
}