feat: AsyncHttpRunner — kickoff (202) + poll-until-terminal#5
Merged
Conversation
Closes the async-shaped HTTP gap that HttpRunner explicitly punted on. Pairs with the new RuntimeKind 'http_async' (RxP PR #2). Behavior: - POST kickoff at http.url; expects 202 + JSON body with run_id at configurable dotted path. 200 also accepted (sync result treated as immediately-terminal). - Substitutes {run_id} in http.poll_url_template, then polls that URL until status (at configurable dotted path) is in terminal_states. Success/failure determined by terminal status membership in success_states. - Sleep between polls is injectable; defaults to time.sleep. Tests use a no-op or a counter to drive the loop deterministically. - Sync from caller's POV — run() blocks until terminal or invocation timeout. No global state; each call uses a short-lived httpx.Client. - Network errors, kickoff non-202/200, run_id extraction failure, poll non-200, status extraction failure, and timeouts each map to distinct error_summary messages. Wire shape lives in RuntimeInvocation.metadata — strings only, matching RxP metadata typing. Comma-separated lists for terminal/success states keep the schema flat. 18 new unit tests covering happy paths (kickoff+poll, alternate JSON paths, sync 200 fast path), validation/rejection (5 missing-metadata cases), kickoff errors (non-202, timeout, run_id extraction), poll errors (non-200, timeout, status extraction), and poll-loop wiring (sleep called between polls, zero interval). 56 ER tests pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
Why
HttpRunner's docstring already explicitly says it's sync-only and tells callers to use `ManualRunner` with a backend dispatcher for async APIs. That workaround is what archon does today — per-call ManualRunner closures synthesizing RuntimeResults. This PR replaces the workaround with a proper async-shaped runner so archon (and anything else with a 202+poll API) can drop the closure dance.
This is the runner part of the AsyncHttpRunner work. Switching archon's invoker to use it is a follow-up PR in OperationsCenter — gated on the archon real-workflow integration design doc that's still pending.
Test plan
🤖 Generated with Claude Code