Skip to content

M3: agent spender end-to-end on the sandbox client (conjunction proof) - #59

Merged
FetchDoge merged 1 commit into
mainfrom
m3-verify-2026-10-20
Oct 20, 2026
Merged

FetchDoge merged 1 commit into
mainfrom
m3-verify-2026-10-20

Conversation

@FetchDoge

Copy link
Copy Markdown
Owner

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):

  • allowed agent spend authorizes with payee/amount trust binding, deliver captures COMPLETED (CAP999 for AUTH999), ledger chain verifies
  • over-cap agent attempt is BLOCKED with zero sandbox wire calls
  • ORDER_NOT_APPROVED raises ApprovalRequired with the cap reservation held; resume_operation authorizes the same order (exactly one order created) and the escrow captures

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.

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T14:43:45.708746Z 4e41a01 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +114 to +115
def fake_urlopen(req, timeout=None):
capture_requests.append(req.full_url)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@FetchDoge
FetchDoge merged commit 691d006 into main Oct 20, 2026
9 checks passed
@FetchDoge
FetchDoge deleted the m3-verify-2026-10-20 branch October 20, 2026 14:45
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