rescue: spec extensions + avp-ollama runner package - #10
Open
Patrick Carney (pcarney8) wants to merge 1 commit into
Open
rescue: spec extensions + avp-ollama runner package#10Patrick Carney (pcarney8) wants to merge 1 commit into
Patrick Carney (pcarney8) wants to merge 1 commit into
Conversation
Additive AVP v0.1 changes to support supervisor-orchestrated execution-
backend rescue (see portofcontext rescue/phase-1 PR). All changes
preserve backwards compatibility with existing conformance suites.
Spec (`spec/v0.1/trajectory.md`):
* New event type `avp.run_rescued` (supervisor-sourced bracket; peer
event in the trajectory; does not restart the span tree).
* New `error_occurred.data.avp.error.code` value `execution_backend_failure`
— runner-side signal that its host environment can no longer continue
(distinct from agent-internal `agent_crash`).
* New optional `data.avp.runner = {backend, model}` per-event field
so consumers can attribute any single event to its producing runner
after a swap.
* New §7.2 (per-event attribution) and §7.3 (rescue pattern) — full
example trajectory included.
Pydantic types:
* `RunRescuedEvent`, `RunRescuedData`, `RunRescuedEndpoint`
(`python/avp/src/avp/types.py`) — round-trip verified.
* `ErrorCode.execution_backend_failure` (`enums.py`).
* Discriminated `Event` union extended; existing tests pass unchanged.
New runner package `python/agents/avp-ollama/`:
* Minimal-scope AVP runner backed by local Ollama. Emits a conforming
AVP trajectory (prelude → multi-turn → cost/stopped) and honors
`RESCUE_FAIL_AT={now|turn:N|prob:p}` failure injection used by the
rescue smoke. README documents scope (single chat loop, no tools,
no managed assets — rescue demo only).
* `OLLAMA_FORCE_TURNS=N` makes the runner chain `N` turns with a
synthetic user-continuation between them, so `RESCUE_FAIL_AT=turn:2`
fires from the realistic "before turn N starts" path rather than
the short-prompt fall-through.
* `AVP_RUNNER_BACKEND` env var stamps the correct identity onto
`avp.runner.backend` in every emitted event — needed when the
supervisor registers the runner under a non-default identity
(e.g. `local-ollama-2`).
* FastAPI dispatch endpoint mirroring `worker/modal_app.py::spawn_endpoint`
so the supervisor's `LocalOllamaBackend` can drive either backend
without caring which is on the other end.
* On startup the runner queries the supervisor's events for the run;
if events already exist it's a rescued continuation — skip the
prelude, start at `next_seq`, inherit the original `agent_started`
span ids so the span tree stays continuous per §7.3.
Workspace plumbing:
* `python/pyproject.toml` workspace members + sources updated.
* `python/uv.lock` regenerated.
Stacks on top of the avp-openai-agent PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
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.
Summary
Stacked on #7 (
avp-openai-agent). Additive AVP v0.1 changes + a new minimal-scope runner backing the supervisor-side rescue work in portofcontext#1.spec/v0.1/trajectory.md§7.2 + §7.3). New event typeavp.run_rescued(supervisor-sourced bracket), newerror_occurredcodeexecution_backend_failure, new optionalavp.runner = {backend, model}per-event attribution field. All additive; existing trajectories remain conformant.RunRescuedEvent/Data/Endpoint,ErrorCode.execution_backend_failure, discriminated union extended.python/agents/avp-ollama/. New AVP runner backed by local Ollama. Minimal-scope: single chat loop, no tools / MCP / managed assets — intentionally — used to demonstrate rescue without taking on full CASDK feature parity. HonorsRESCUE_FAIL_AT(failure injection),OLLAMA_FORCE_TURNS(multi-turn forcing soturn:Nfires on a real boundary),AVP_RUNNER_BACKEND(so the same runner code can register under different identities for the rescue demo's primary/secondary pair).next_seqfrom the supervisor — if events already exist, it's a rescued continuation: skip the prelude, start emitting atnext_seq, inherit the originalagent_startedspan ids so the span tree stays continuous per §7.3.Test plan
cd python && uv run pytest avp/tests/ -q— 116 passing, no regressions from the additive event type.cd python && uv run pytest agents/avp-ollama/tests/ -q— 11 passing.RunRescuedEvent(...).model_dump_json(by_alias=True)produces a valid CloudEvents envelope withsource: avp://supervisor.make demo-rescue-local): primarylocal-ollamafails at turn 2 → supervisor emitsavp.run_rescued→ secondarylocal-ollama-2picks up →agent_stopped(converged).Out of scope
Commission.resume, deterministic replay) — tracked in portofcontextRESCUE_PLAN.mdphase 2.🤖 Generated with Claude Code