implement-strong-agent

Implement strong-agent merge resolution lane

Metadata

Statusdone
Assignedagent-919
Agent identity6841f97a7a8e6cbc213051ce0ffb3c85c92c80cb61fd699428ab3fed6cb6ba94
Created2026-07-26T12:00:12.542946585+00:00
Started2026-07-27T20:48:01.138662172+00:00
Completed2026-07-27T21:31:37.029372003+00:00
Tokens16931441 in / 37184 out

Description

Objective

Implement the ratified strong-agent merge-resolution lane on top of the authoritative lifecycle and crash-safe immutable-candidate finalizer. Clean deterministic merges remain purely mechanical and make zero model calls. A real textual/semantic/generated integration conflict uses one content-bound explicitly routed full strong coding agent, while ambiguity or unsafe content stops for a human/review decision. No resolution path may silently mutate main.

Prerequisites, scope, and authority

Implement only after docs/design-strong-agent-merge-resolution.md and the crash-safe candidate transaction land. Consume their immutable descriptors, lifecycle projections, evaluator interface, ledger/outbox, and merge authority; do not create a second candidate/status/evaluation/merge path. The worker/source worktree and original candidate are immutable, evaluators are read-only, and only the central merge authority may CAS canonical main after all gates accept.

This task owns the deterministic integration classifier, lazy resolution request/run, explicit strong-route snapshot, isolated integration worktree, resolution descriptor, gate handoff, replay/diagnostics, and user actions. If the ratified lifecycle/finalizer/evaluator seams differ, stop and amend the contract rather than bypassing them.

Deterministic classification

Implement stable evidence-bearing outcomes with fail-closed precedence:

  • MechanicalMerge: exact candidate/base/target dry merge is conflict free, no unresolved marker or generated/policy/safety ambiguity exists, required integration checks pass, and target is unchanged. It invokes zero LLMs.
  • CandidateRepairRequired: candidate fails its independent deterministic checks; route to source repair, not merger.
  • MergeResolutionRequired::TextualConflict: overlap/add-add/rename-delete/modify-delete/submodule/dependency-lock or equivalent real text/tree conflict.
  • MergeResolutionRequired::SemanticIntegrationConflict: candidate and target checks pass separately, textual merge is clean, but the combined tree fails a pinned compile/test/schema/API/invariant check. Persist all three receipts.
  • MergeResolutionRequired::GeneratedArtifactConflict: only with known source-of-truth ownership and a deterministic pinned generator. Merger edits sources and regenerates; generated output is never hand-edited.
  • NeedsHumanMergeDecision: product/user intent ambiguity, plausible incompatible behaviors, policy-sensitive authority, unknown/nondeterministic generated ownership, or merger uncertainty.
  • SecurityReviewBlocked/ResolutionRejected: canonical lint/review rejects or quarantines malicious/untrusted diff/conflict content before merger launch. Accepted untrusted bytes remain spotlighted inert data and the output is reviewed again.

Unknown/unlabeled state, classifier/tool failure, and policy uncertainty may never take the mechanical path. Persist reason codes, commands, exits, tree IDs, conflict maps, generator evidence, safety verdicts, and policy snapshot.

Exact strong route; no fallback

Resolve and persist one ResolutionRouteSnapshot before enqueue: fully qualified handler-first model spec, provider/model, strong/premium assertion and provenance, high/xhigh reasoning, config/profile revision, budget, and tool policy. Prefer an exact models.merger; a permitted named tier must resolve once to one exact route. Reject weak/fast routes.

Missing/invalid route, auth/executor unavailability, unsupported reasoning, timeout, and budget exhaustion enter visible StrongRouteUnavailable/operator hold. Never downgrade to weak, substitute another model/provider/executor, retry a different route, ask the coordinator/evaluator to edit, or relabel the conflict mechanical. Operator route changes create a new audited route/run generation; retries of the same generation use the same route snapshot.

Isolated, content-bound resolution

  • Lazily enqueue exactly one resolution run only after MergeResolutionRequired, keyed by candidate commit/tree/manifest CID + base + target commit/tree + conflict/evidence digest + policy + route. Clean/human/security/source-repair cases create no merger satellite/call.
  • Materialize an isolated integration clone/worktree at the exact target and candidate objects. Give the strong agent full edit/build/test tools only there. Deny canonical repository .git/main, shared-ref mutation, remote push credentials, source worktree/candidate writes, graph/status mutation, and evaluator/merge-authority tools. Prove that a mutation/push/ref-update probe fails.
  • Provide the ratified content-addressed spotlighted bundle: task/user intent, immutable candidate, base, target, both diffs, dependency/generated metadata, validation/evaluation evidence, conflict map, policies, and repository tools. Treat conflict text and repository files as untrusted data, not model instructions.
  • Seal output as a new immutable ResolutionCandidateDescriptor with parent candidate/base/target IDs, request/run/session and exact route, commit/tree/manifest CID, changed/conflict disposition, generator command/tool/output digests, test/tool/safety evidence, explanation, and resolved/reject/needs-human outcome. Never mutate or retag the source candidate.
  • Any modified resolution bytes are new untrusted bytes. Run canonical safety review, full deterministic validation, and newly selected bounded evaluation/deep-readonly FLIP against that exact resolution descriptor. Do not reuse the original candidate verdict as authorization. A reject retains original+resolution descriptors and creates linked repair/new-version state.
  • Central acceptance verifies every binding and target-head equality, imports/applies exactly the accepted resolution tree, atomically CASes main, verifies the resulting tree equals the accepted descriptor, and records one content-bound merge receipt. Duplicate delivery/restart returns the same receipt. Target movement marks the request stale and reclassifies against a new immutable target; never auto-rebase or merge a stale resolution.

Replay, human action, rollback, and visibility

Drive classifier, route, workspace, process, descriptor seal, safety/validation/evaluation requests/results, acceptance CAS/receipt, retention, and cleanup through the durable ledger/outbox with stable idempotency keys. Add fault barriers around every durable boundary. Unknown/source-bearing/unaccepted work is retained; cleanup is ancillary and cannot change semantic state.

A human decision is bound to candidate/target/evidence digests and author/rationale/constraints. Resume creates a new resolution generation and still runs every gate; human approval never directly writes main or bypasses route/safety/validation/evaluation. Before acceptance, reject/abort leaves main/source untouched after evidence retention. After acceptance, rollback creates a compensating immutable candidate/commit through the same gates and central CAS; never hard-reset main or erase the original receipt.

Expose CLI/TUI status/actions without eager graph clutter: classifier/reason/evidence, candidate/base/target IDs, safety state, exact route strength/provenance/reasoning, run/session, integration isolation, resolution CID, each fresh gate binding, target drift, merge receipt, retention, and safe actions for inspect/materialize/retry-same-route/change-route/repair/escalate/reject/rollback. No action may imply fallback.

RED-first implementation and permanent validation

Write fixtures first and preserve the pre-change failure evidence. Use a credential-free deterministic fake strong-merger adapter which asserts exact route/reasoning/capability/bundle IDs and records invocation count.

  1. Classifier table: clean merge calls fake merger zero times; candidate-invalid calls zero; text conflict calls exactly once; clean semantic failure with each side independently passing calls exactly once; deterministic generated conflict regenerates from sources; unknown generated ownership and ambiguous intent stop for human; malicious/untrusted prompt-like conflict is blocked/quarantined or contained as data and cannot change route/tools/verdict.
  2. Content/authority: source candidate/worktree and canonical main/ref hashes stay unchanged while resolving; direct mutation/push/ref probes fail; resolution descriptor, safety/validator input, new evaluator verdict, merge request/receipt, and resulting tree bind the same resolution CID/tree; post-seal edits require a new version.
  3. Failure/replay: absent/weak/unavailable route has no fallback; malformed output, timeout/budget, rejection/repair, duplicate request/verdict, concurrent target movement, stale route, daemon restart/fault injection at every boundary, cleanup failure, and repeated human actions converge without duplicate calls/charges/merges or lost bytes.
  4. Real human flow: through installed wg, real daemon/service, real immutable source candidate, and real isolated integration worktree (fake merger only for credentials), demonstrate clean -> zero model calls; conflict -> explicit strong resolution -> safety -> revalidation -> fresh evaluation -> exactly-once identical merge; semantic conflict; conflict -> human stop; generated ambiguity; malicious diff; rejection/repair; restart/target movement; inspect/status; and compensating rollback. It must fail on pre-change main and cannot be a helper/library-only substitute.

Add a grow-only scenario such as tests/smoke/scenarios/strong_agent_merge_resolution.sh and register owners = [implement-strong-agent] in tests/smoke/manifest.toml. Name focused unit/model/property tests. Run pinned stable cargo fmt, cargo fmt --check, cargo clippy, cargo build, cargo test, cargo install --path . --locked, then the owned smoke.

Validation

  • RED classifier fixtures distinguish mechanical, candidate-invalid, textual, semantic, generated deterministic/ambiguous, human-intent, policy, and malicious/untrusted outcomes; only eligible conflicts invoke exactly one fake strong merger and clean merge invokes zero.
  • One exact strong/premium high/xhigh route is snapshotted; weak/missing/unavailable/failed routes hold visibly and never cross-model/provider/executor fallback or become mechanical.
  • Strong coding capability is confined to an isolated integration worktree; source candidate/worktree, canonical main, graph, and shared refs cannot be mutated before central acceptance.
  • Modified resolution bytes get a new immutable descriptor plus fresh safety review, deterministic validation, and policy evaluation/FLIP; accepted tree is content-identical to the exactly-once merged tree.
  • Crash/replay, duplicate events, target movement, rejection/repair, generated regeneration, human escalation, retention/cleanup, and compensating rollback are safe and explicit.
  • Permanent installed-binary real-daemon/integration-worktree terminal smoke is owned by this task and exercises conflict->strong->revalidate/reevaluate->merge plus conflict->human stop; focused tests, fmt, clippy, build, test, install, and smoke pass.

Depends on

Required by

Messages 2 messages (2 unread)

  1. #1design-strong-agent2026-07-26T21:19:59.302664956+00:00delivered
    Design complete in docs/design-strong-agent-merge-resolution.md (fb5e70ad). It is implementation-ready and consumes candidate finalization + Pi evaluation contracts; key seams include zero-call classifier, exact models.merger snapshot/no fallback, standalone integration clone, immutable resolution descriptor/fresh gates, complete-tree CAS receipt, replay/human/rollback, and owned live smoke.
  2. #2implement-strong-agent2026-07-27T20:48:08.466364762+00:00read
    Acknowledged design handoff — I will implement against docs/design-strong-agent-merge-resolution.md and the crash-safe finalization seams, preserving zero-call mechanical merges and exact no-fallback routing.

Log