Repository navigation
M3: agent spender end-to-end on the sandbox client (conjunction proof) - #59
Conversation
SpendTools + SpendPipeline backed by the real SandboxPayPalClient, HTTP stubbed at the transport boundary (no network, no credentials): allowed agent spend authorizes with trust binding and deliver captures COMPLETED; over-cap attempt is BLOCKED with zero sandbox wire calls; ORDER_NOT_APPROVED raises ApprovalRequired with the reservation held and resume_operation authorizes the same order (one create total). 402 passed, 1 skipped, plain and under python -O.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e41a0119a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| assert json.loads(tools.check_permit())["remaining_cents"] == 2000 | ||
| assert capture_requests == [] | ||
|
|
||
| attempt = tools.flow.resume_operation(appr) |
There was a problem hiding this comment.
Test approval resume through SpendTools
When the sandbox order needs payer approval, the real agent runner calls attempt_spend via _execute_tool, which converts ApprovalRequired into a generic error; SpendTools exposes no resume operation, and its escrow-to-purpose mapping is never populated, so the agent cannot subsequently call deliver. This test bypasses those gaps by invoking tools.flow.resume_operation directly and later calling tools.flow.release, allowing the advertised agent end-to-end path to pass even though it is unavailable through the agent tool surface. Add an agent-facing continuation that registers the resumed escrow and exercise both resume and delivery through SpendTools.
Useful? React with 👍 / 👎.
| def fake_urlopen(req, timeout=None): | ||
| capture_requests.append(req.full_url) |
There was a problem hiding this comment.
Validate the outbound capture request
The transport stub records only req.full_url and returns COMPLETED regardless of the request method, body, or headers. Consequently, this end-to-end test still passes if SandboxPayPalClient.capture sends the wrong amount or currency, uses a non-POST method, or drops the PayPal-Request-Id needed for retry safety; no existing sandbox-client test inspects this capture request. Record the request itself and assert its method, JSON amount, authorization header, and stable idempotency header before returning the fake response.
Useful? React with 👍 / 👎.
Closes the M3 conjunction gap ahead of the Oct 23 milestone review.
Already proven separately: the agent loop inside its permit on the mock rail (tests/test_agent.py), the SandboxPayPalClient order lifecycle on stubbed HTTP (tests/test_sandbox_client.py), pipeline ApprovalRequired + resume on a fake client (tests/test_authority_layer.py), and a live sandbox capture on 2026-10-05 driven by scripted launch beats (not the agent loop).
New tests/test_agent_sandbox_e2e.py (3 tests) proves the conjunction with the real SandboxPayPalClient under the agent SpendTools, HTTP stubbed at the transport boundary (no network, no credentials):
Full suite: 402 passed, 1 skipped, plain and under python -O (399 baseline on main 75d823f + 3 new). Demos: demo.py, demos/demo_admission.py, six-beat --replay all run clean, ledger chains VERIFIED.
The live-wire version of this path remains the sandbox_live tier and still needs sandbox credentials; no test in the suite is currently marked sandbox_live, and the Oct 5 launch run remains the live evidence.