feat(candidate): execute through exact process providers#574
Conversation
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — ceb6f747
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
tangletools · auto-approval · reason: drewstone_author · 2026-07-20T22:45:00Z
tangletools
left a comment
There was a problem hiding this comment.
🟡 Value Audit — sound-with-nits
| Verdict | sound-with-nits |
| Concerns | 1 (1 weak-concern) |
| Heuristic | 0.0s |
| Duplication | 0.0s |
| Interrogation | 293.1s (2 bridge agents) |
| Total | 293.1s |
💰 Value — sound
Clean swap of the Sandbox-only candidate executor for a provider-neutral one over the new exactProcess contract; old code fully removed, new code is the single AgentCandidateExecutorPort implementation and matches the codebase's stated direction.
- What it does: Deletes src/intelligence/sandbox-approved-candidate.ts (681 lines, SandboxClient-coupled) and its test, and replaces them with src/candidate-execution/exact-process-executor.ts (730 lines, new) implementing AgentCandidateExecutorPort against provider.exactProcess (the slot added in @tangle-network/agent-interface 0.32.0), plus a 117-line Intelligence-layer wrapper (src/intelligence/exact-process-c
- Goals it achieves: Decouple the 'measure a candidate before promoting it' executor from the @tangle-network/sandbox SDK so any provider that declares exactProcess + egress capability can host a candidate cell. Aligns the candidate-execution seam with the existing AgentEnvironmentProvider abstraction already driving runtime/environment-provider.ts and runtime/supervise/runtime.ts (where SandboxClient is the legacy su
- Assessment: Sound and in-grain. (1) It is a true replacement, not a parallel path: git grep shows ExactProcessAgentCandidateExecutor is the only AgentCandidateExecutorPort implementation in src/; the old SandboxAgentCandidateExecutor and the createSandboxCandidateExperimentExecutor / sandboxCandidateExperimentExecutionSupport exports are gone from src, tests, docs, and scripts/verify-package-exports.mjs. (2)
- Better / existing approach: none — this is the right approach. Searched for and ruled out: (a) other AgentCandidateExecutorPort implementations to extend — none exist, the deleted Sandbox one was the only other; (b) reuse of providerAsExecutor from src/runtime/environment-provider.ts:278 — different port (the runtime Executor for multi-turn agents vs. the one-shot candidate cell port), different lifecycle, not a candidate fo
- Model: opencode/zai-coding-plan/glm-5.2
- Bridge attempts: 2
- Bridge warning: opencode/kimi-for-coding/k2p7: bridge stream ended without value-audit content
🎯 Usefulness — sound-with-nits
Clean refactor of the candidate executor from a Sandbox-SDK-coupled adapter to a provider-neutral exact-process adapter, matching the repo's documented migration plan; structurally isomorphic to the deleted predecessor and wired through the same Intelligence experiment cell.
- Integration: The new
exactProcessProviderAsCandidateExecutor(src/candidate-execution/exact-process-executor.ts:61) implements the existingAgentCandidateExecutorPort(execute/stop/capture/dispose) and is consumed bycreateExactProcessCandidateExperimentExecutorin src/intelligence/exact-process-candidate.ts:73, which in turn drives the unchangedexecuteAgentCandidateExperimentCell(src/intelligence/im - Fit with existing patterns: Fits the established grain precisely. The predecessor
src/intelligence/sandbox-approved-candidate.ts(deleted in 57fb0b6) was the only Sandbox-only outlier in an otherwise provider-neutral stack: docs/research/environment-provider-adapter-spec.md:28-48 explicitly calls for lifting execution above theSandboxInstanceSDK shape so third-party providers implement one contract. The new executor pr - Real-world viability: The new executor's error and concurrency paths mirror the deleted predecessor almost line-for-line: signal-linked cancellation (exact-process-executor.ts:198-218), idempotency keys derived from executionId+plan digest (line 673), fresh-environment invariant check (line 175-178), terminal-status assertion across
wait()vsstatus()(line 632-642), output size enforcement with cleanup-on-exceed ( - Model: opencode/zai-coding-plan/glm-5.2
- Bridge attempts: 1
🎯 Usefulness Audit
🟡 In-tree sandbox provider adapter does not yet expose exactProcess [integration] ``
exactProcessProviderAsCandidateExecutorrequiresoptions.provider.exactProcessand the executor throws at construction if absent (src/candidate-execution/exact-process-executor.ts:77-81). The only in-treeAgentEnvironmentProvideradapter,sandboxClientAsProvider(src/runtime/environment-provider.ts:218), does not populatecapabilities.exactProcessnor wrapSandboxInstance.process.spawnExactinto theAgentExactProcessProvidershape — so until either that adapter is extended in a fol
What this audit checks
It judges the change on its merits — not whether it was tasked out in an issue. Unticketed, fast-moving work is fine; the question is whether the change is good and whether a better or existing approach should be used instead.
| Pass | What it asks |
|---|---|
| Heuristic | Vague title? Whitespace-only or cruft-bearing diff? (content signals only) |
| Duplication | Do added function/class names already exist elsewhere in the repo? |
| Value Audit | What does it do? What goal does it achieve? Is it good? Better architecture or already-exists? |
| Usefulness Audit | Does it integrate and fit? Will it hold up in real use and actually get used? |
Findings are concerns, not blocks — the human reviewer decides what to do with them.
|
Follow-up to the failed agent-bench check: the Pier candidate fixture now declares its public PATH, and agent-bench is released as 0.3.7 with agent-interface 0.32.0 so its packed manifest matches agent-runtime 0.102.0. Local proof: pnpm run verify:bench (build, public types, 25 benchmark files plus Pier, packed consumer on TypeScript 5.9.3 and 6.0.3); pnpm test (151 files, 1,582 passed, 2 skipped); pnpm typecheck; pnpm lint; pnpm verify:package; pnpm docs:check. The in-tree sandboxClientAsProvider is deliberately not the product integration target: products will use @tangle-network/agent-provider-tangle@0.3.0, which owns the Sandbox SDK exact-process mapping. Extending the in-tree adapter would duplicate that provider. |
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 711833ba
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
tangletools · auto-approval · reason: drewstone_author · 2026-07-20T23:27:50Z
tangletools
left a comment
There was a problem hiding this comment.
🟡 Value Audit — sound-with-nits
| Verdict | sound-with-nits |
| Concerns | 1 (1 weak-concern) |
| Heuristic | 0.0s |
| Duplication | 0.0s |
| Interrogation | 273.5s (2 bridge agents) |
| Total | 273.5s |
💰 Value — sound
Cleanly decouples Intelligence's measured-candidate experiment executor from the Sandbox SDK by routing it through the existing AgentEnvironmentProvider's new exact-process contract — a coherent, mostly 1:1 port that matches the codebase's grain.
- What it does: Deletes src/intelligence/sandbox-approved-candidate.ts (681 lines) and src/intelligence/sandbox-approved-candidate.test.ts (598 lines) — an executor that called sandbox.process.spawnExact directly on @tangle-network/sandbox's SandboxInstance. Replaces them with src/candidate-execution/exact-process-executor.ts (730 lines) + src/intelligence/exact-process-candidate.ts (117 lines) + tests/exact-proc
- Goals it achieves: Read from the change itself: (1) Make the measured-candidate experiment path provider-neutral so any environment provider that declares exact-process capability can host it, not only the Tangle Sandbox. (2) Collapse the last Intelligence-side bypass of the repo's existing AgentEnvironmentProvider abstraction (src/runtime/environment-provider.ts:178-264 already defines sandboxClientAsProvider / pro
- Assessment: Coherent and in-grain. The new ExactProcessAgentCandidateExecutor preserves the old invariants almost line-for-line — execute/stop/capture/dispose lifecycle, immutable candidate material + idempotency key, recovery via list-and-match-by-metadata, fresh-environment pre-check, signed-PATH requirement, output-byte cap, cancellation-then-await ordering, trace-once append. The extensions it adds (cpu/m
- Better / existing approach: none — this is the right approach. I searched for an existing equivalent (grep AgentExactProcessProvider / spawnExact across src/, tests/, bench/) and confirmed: (a) nothing in this repo previously implemented AgentExactProcessProvider — the contract is new in agent-interface 0.32.0; (b) the existing sandboxClientAsProvider (src/runtime/environment-provider.ts:218) only adapts provider.create/get/
- Model: opencode/zai-coding-plan/glm-5.2
- Bridge attempts: 2
- Bridge warning: opencode/kimi-for-coding/k2p7: bridge stream ended without value-audit content
🎯 Usefulness — sound-with-nits
Replaces a Sandbox-coupled candidate executor with a provider-neutral one that matches Runtime's established AgentEnvironmentProvider pattern, fully wired into the existing experiment-cell pipeline with the bench already updated for the new contract.
- Integration: Reachable and correctly wired. exactProcessProviderAsCandidateExecutor (src/candidate-execution/exact-process-executor.ts:61) produces an AgentCandidateExecutorPort consumed by executeAgentCandidateExperimentCell (src/intelligence/improvement-cycle.ts:226) via executePreparedAgentCandidate. createExactProcessCandidateExperimentExecutor (src/intelligence/exact-process-candidate.ts:73) is the produc
- Fit with existing patterns: Excellent. The deleted src/intelligence/sandbox-approved-candidate.ts (681 lines) was a parallel Sandbox-specific executor that duplicated the same lifecycle (idempotency, recovery, evidence capture, output bounds) the runtime layer already standardized on. This PR collapses that fork onto the shared provider contract. No competing pattern remains: providerAsExecutor is the established way Runtime
- Real-world viability: Robust. The executor handles: abort linkage via addEventListener('abort', cancel, {once:true}) plus an explicit re-check (src/candidate-execution/exact-process-executor.ts:203-204); idempotency keys derived from executionId+plan digest (line 152-155, 673-679); AggregateError when validation AND cleanup both fail (line 165-169); output byte-cap enforcement with kill-on-overflow (collectOutput, line
- Model: opencode/zai-coding-plan/glm-5.2
- Bridge attempts: 1
🎯 Usefulness Audit
🟡 Stale reference to removed createSandboxCandidateExperimentExecutor in canonical-api.md [integration] ``
docs/canonical-api.md:114 still tells products to 'use createSandboxCandidateExperimentExecutor(...) for fresh Tangle sandboxes', but that symbol was deleted in this PR (src/intelligence/sandbox-approved-candidate.ts removed) and replaced by createExactProcessCandidateExperimentExecutor. The auto-generated docs (docs/api/intelligence.md:4410, docs/api/primitive-catalog.md:323) were regenerated correctly; only the hand-curated canonical-api.md is stale. One-line fix to swap the symbol name and up
What this audit checks
It judges the change on its merits — not whether it was tasked out in an issue. Unticketed, fast-moving work is fine; the question is whether the change is good and whether a better or existing approach should be used instead.
| Pass | What it asks |
|---|---|
| Heuristic | Vague title? Whitespace-only or cruft-bearing diff? (content signals only) |
| Duplication | Do added function/class names already exist elsewhere in the repo? |
| Value Audit | What does it do? What goal does it achieve? Is it good? Better architecture or already-exists? |
| Usefulness Audit | Does it integrate and fit? Will it hold up in real use and actually get used? |
Findings are concerns, not blocks — the human reviewer decides what to do with them.
✅ No Blockers —
|
tangletools
left a comment
There was a problem hiding this comment.
✅ Approved — 12 non-blocking findings — 711833ba
Full multi-shot audit completed 8/8 planned shots over 19 changed files. Global verifier still owns final merge decision.
Full immutable report for this review: trace
Summary comment for this run: full summary
tangletools · 2026-07-21T00:42:59Z · immutable trace
Problem
Candidate execution was coupled to a Sandbox-specific adapter and could not reuse the exact process contract across environment providers.
Change
Checks
No product activation path is changed in this PR.