Skip to content

Harness: post-bridge hardening (merge-agent isolation, doctor version check, per-ref provenance) #775

Description

@marcusrbrown

Follow-up items deferred from the integrate→build bridge work (#774). None block a first patched release; each is a contained hardening improvement.

1. Isolate the LLM merge agent from the auth secret and redact failure output

The integrate job runs opencode run with model credentials provisioned to a 0600 file. The credential is never echoed and the job is read-only (no id-token, no push), but the autonomous merge agent and its tools can read the filesystem, including the auth path, and a raw failure message could in principle surface command output.

  • Run the merge under a restrictive permissions/sandbox policy so spawned tools cannot read the credential path or reach the network outside the merge repo.
  • Add a single-line, length-capped, secret-redacting error formatter for integrate/opencode failures instead of printing raw Error.message.

2. harness doctor version check is stale relative to the +harness.<sha> scheme

cmdDoctor compares a built binary --version against the bare base version (e.g. 1.15.13), but built harness binaries now self-report <baseVersion>+harness.<shortSha> via buildHarnessVersion(). For a genuinely built artifact this equality check fails. cmdDoctor is not on the release path (the build path uses verify-binary.ts, which expects the +harness.<sha> form), so this is latent, not a regression — but the new version scheme makes it reachable.

  • Update cmdDoctor to accept the +harness.<shortSha> version form.

3. Per-ref provenance collapses to the integration commit

runIntegration sets every ref's resolvedSha to the shared integration commit. The provenance manifest therefore cannot record the actual upstream SHA each ref resolved to. Acceptable under the current 1–3 ref carry policy, but it weakens per-ref auditability.

  • Resolve and record each ref's actual upstream SHA in the provenance manifest.

Optional test additions (from review)

  • Assert the produced artifact contains no .git directory (the clean-snapshot guarantee underpins the handoff).
  • Assert --source-tree pointing at a non-empty non-git directory builds without invoking the clone path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions