Skip to content

4312fbd4: Agent Wrapper Architecture#166

Merged
philippepascal merged 326 commits into
mainfrom
epic/4312fbd4-agent-wrapper-architecture
May 2, 2026
Merged

4312fbd4: Agent Wrapper Architecture#166
philippepascal merged 326 commits into
mainfrom
epic/4312fbd4-agent-wrapper-architecture

Conversation

@philippepascal
Copy link
Copy Markdown
Owner

Epic: epic/4312fbd4-agent-wrapper-architecture

…s not a known built-in" in Acceptance criteria
…c' into epic/4312fbd4-agent-wrapper-architecture
…itecture' into ticket/2803bf07-output-parser-strategy-external-parsers-
Wire parser/parser_command from manifest.toml into CustomWrapper::spawn.
Canonical mode is unchanged. External mode spawns the wrapper with piped
stdout, passes it to the parser's stdin via an OS-level pipe, and captures
the parser's stdout/stderr to the log. The wrapper is reaped in a background
thread so it doesn't zombie. apm validate now catches parser = external
without parser_command. Unit and integration tests cover all branches.
…-' into epic/4312fbd4-agent-wrapper-architecture
…itecture' into ticket/25c92daa-mock-and-debug-built-in-wrappers-mock-ha
Register four new built-in wrappers in the dispatcher. Add WrapperContext.current_state field and wire all call sites. Create wrapper/builtin/ module structure with shared helpers. Annotate in_design and ammend to-specd transitions with outcome=success. Add per-agent instruction stubs for all four new wrappers.
…a' into epic/4312fbd4-agent-wrapper-architecture
Cross-cutting fixes flagged in the implementation review of epic
4312fbd4 (agent wrapper architecture):

- start.rs: route resolve_system_prompt through params.agent (post
  frontmatter override) instead of literal "claude", so per-agent
  instructions resolve correctly when agent is overridden via config
  or ticket frontmatter
- start.rs: gate check_output_format_supported on the resolved
  wrapper actually being the claude built-in; mock/debug agents and
  custom wrappers no longer require the claude binary on PATH
- start.rs: enumerate built-ins dynamically in the not-found error
  rather than the stale "{claude}" literal
- start.rs: refactor emit_deprecation_warning to take a Write so
  the test asserts on captured output (the writer that production
  passes is stderr.lock()), per the 6cac8518 amendment
- agents.rs: switch the configured-marker to read workers.agent and
  iterate worker_profiles for per-profile labels, replacing the
  legacy workers.command lookup
- validate.rs: refactor validate_agents to return (errors, warnings)
  and add validate_all single-pass entry point; CLI now scans
  .apm/agents/ once instead of twice per `apm validate` invocation
- validate.rs: simplify the dead-end BFS — unknown transition
  targets are reported by validate_config; reachability skips them
  rather than inlining a stripped resolve_outcome
- validate.rs: enumerate built-ins dynamically in the not-found
  error message
- wrapper/custom.rs: default_contract_version returns CONTRACT_VERSION
  so manifests without an explicit field track the current contract
  on every bump; replace the tautological default test with one that
  exercises the production code path
- wrapper/builtin/claude.rs: extract build_claude_args; share between
  spawn_local and spawn_container; add unit tests verifying --model
  and --dangerously-skip-permissions reach argv
- wrapper/builtin/debug.rs: extract DEBUG_SCRIPT const; add tests
  asserting the script dumps APM_ env, emits one canonical event,
  outputs prompt+message to stderr, self-cleans
- wrapper/builtin/mock_random.rs: extract pick_transition_idx; tests
  cover determinism, distribution, and bounds
- wrapper/builtin/mod.rs: tests for seed_from_ctx (explicit option
  path), happy_script content (impl/spec modes), sad_script content,
  is_impl_mode predicate
@philippepascal philippepascal merged commit 4330b1b into main May 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant