SpecBridge v0.3: agent runners and evidence-gated task execution#3
Merged
Conversation
Implement a safe, auditable, model-assisted development workflow on top of approved Kiro-compatible specs (roadmap Phases F and G). Runners: - Generic runner contract (detect / generateStage / executeTask / resumeTask) with a registry, discriminated statuses, and structured outcomes; deterministic scenario-driven mock runner; honest stubs for codex/ollama/openai-compatible. - Claude Code local-CLI runner: executable/auth detection, help-token capability probing with graceful degradation, argv-array invocation with prompts over stdin, session ids, timeouts, cancellation, and output size limits. Permission bypasses are rejected at three layers. - Read-only diagnostics: runner list / doctor / show. Authoring: - spec generate / spec refine with versioned prompt contracts, workflow prerequisites per mode, read-only generation tools, deterministic candidate validation (invalid candidates retained, never applied), unified diffs, atomic writes, and dependent-approval invalidation. Nothing is ever auto-approved; approved stages are never overwritten. Execution: - spec run: one approved task per run, pre-run validation, bounded task context, git before/after snapshots with hash-exact attribution, trusted verification commands from .specbridge/config.json, and deterministic evidence evaluation. The checkbox flips only for verified evidence, via the surgical single-line writer (the tasks approval hash is re-recorded for SpecBridge's own sanctioned edit). - Append-only run records (.specbridge/runs/) and evidence (.specbridge/evidence/), run list / show / resume with divergence detection and parentRunId lineage, sequential --all that stops at the first unverified task, spec accept-task for explicit audited manual acceptance, exit codes extended with 3-6. Testing and docs: - 362 tests (117 new) including a fake Claude CLI process fixture; CI needs no Claude installation and no network. New docs for runners, authoring, execution, evidence, verification, resume, and security; skill updated as a thin CLI wrapper; versions bumped to 0.3.0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- macOS: a fast-exiting child can finish before execa flags the output overflow, leaving truncated output on a "successful" result that was then misparsed as malformed output. Output at or beyond the configured limit is now treated as an overflow regardless of the isMaxBuffer flag (execa truncates TO the limit, so at-limit output is indistinguishable from one) and is never parsed. - Windows: the v0.3 execution suites are process-level integration tests (git snapshots, runner subprocesses, verification commands); slow CI runners exceeded vitest's 5s default. Raise testTimeout to 30s. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
process.stdout.write queues asynchronously and process.exit discards the queue, so on macOS (node 20) the huge-output scenarios could exit having flushed less than the parent's configured limit — turning the intended output-limit test into an under-limit garbage result. Blocking writeSync either delivers everything or hits EPIPE when the parent stops reading at its limit; both paths are deterministic on every platform. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
v0.3 implements roadmap Phases F (runner adapters) and G (task execution with evidence): a safe, auditable, model-assisted development workflow on top of approved Kiro-compatible specs.
.kiroremains the source of truth for spec content;.specbridgenow also owns runner configuration, run records, execution evidence, verification results, and resumable run metadata.Runners (
@specbridge/runners, rebuilt)detect/generateStage/executeTask/resumeTask?, with discriminated statuses (available,unavailable,unauthenticated,incompatible,misconfigured,error) and structured outcomes. Runners return observations only — they never touch checkboxes and never judge evidence.codex/ollama/openai-compatibleremain honestunsupportedstubs.runner list,runner doctor [name],runner show <name>— read-only,--json, never echo credentials.Model-assisted authoring (
spec generate/spec refine).kirofile after deterministic v0.2 analysis. Invalid candidates are retained under the run directory and never applied. Refinement shows a unified diff. Dependent approvals are invalidated on content change.Read,Glob,Grep).Task execution (
spec run) — new packages@specbridge/evidence+@specbridge/execution--allow-dirtycaptures a hash-exact baseline; pre-existing changes are never attributed to the task)..kiro/**, sidecar config/state), patch capture with size limits, moved-HEAD detection (runners must never commit)..specbridge/config.json(argv arrays; shell strings rejected; never derived from spec content or model output).verified(or explicitmanually-accepted) evidence flips a checkbox — via the v0.1 surgical writer (one character, one line; the tasks approval hash is re-recorded for SpecBridge's own sanctioned edit)..specbridge/runs/<run-id>/: prompt, raw output, snapshots, verification, evidence, report) and evidence (.specbridge/evidence/<spec>/<task>/);run list/run show/run resumewith repository-divergence detection andparentRunIdlineage; sequential--allstops at the first unverified task;spec accept-task --reasonfor audited manual acceptance.Security (each control tested)
bypassPermissions/dangerously-skip-permissionsrejected at three layers (config schema, argv assembly, pre-spawn assertion) with no override.Why
The v0.2 workflow ends at approved specs. v0.3 closes the loop — approved spec → bounded task context → one agent-executed task → actual git evidence → trusted verification → checkbox — without ever trusting a model's claim of success, and while keeping the zero-migration promise intact (byte-identical round trips are regression-tested throughout).
Testing
scripts/smoke.mjs22/22 against the built CLI.tests/fixtures/fake-claude/) covering detection, auth redaction, capability degradation, argv purity, timeouts, cancellation, output limits, malformed output, and resume flags — CI needs no Claude installation and no network.[ ]→[x], unrelated bytes identical), failed verification (evidence retained, checkbox unchanged), protected-path violation (flagged, no rollback), resume (lineage preserved, divergence refused), manual acceptance (reason required, recorded distinctly).runner doctor claude-codevalidated against the actual Claude Code 2.1.141 installed on the dev machine.Reviewer notes
packages/runnerswas rebuilt around the new contract (the v0.1 layer was detection-only by design); the old interface had no CLI consumers..specbridge/and.kirofiles whose bytes hash-match recorded approvals (docs/task-execution.md);--allimplicitly baselines earlier tasks' uncommitted work (runs never commit); resume attributes against the original run's baseline but judges protected paths/HEAD against the resume session start (docs/session-resume.md).🤖 Generated with Claude Code