Skip to content

Integrate verified testnet payment compatibility and Python operator fixes - #2

Merged
DamirAGI merged 26 commits into
mainfrom
integrate/testnet-verified-20261107
Nov 7, 2026
Merged

DamirAGI merged 26 commits into
mainfrom
integrate/testnet-verified-20261107

Conversation

@DamirAGI

@DamirAGI DamirAGI commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Aligns canonical/legacy kernel decoding, accepted-quote payments through the real adapter/wallet, and AsyncWeb3 event APIs. Shared cross-SDK vectors are packaged byte-for-byte for standalone CI; Python 3.9–3.12 support is retained.

The operator fixes preserve successful watch exit codes, forward the explicit transition proof, and await registry transaction construction before signing. The stdlib HTTP fallback accepts HTTP(S) and validates redirects while preserving fractional timeouts. Patched cryptography 50.x retains actual Python 3.9 support. DeliveryProof verification now distinguishes legacy and canonical schemas sharing the same EIP-712 type name and rejects incomplete/ambiguous payloads. Agent.request resolves the provider through the actual service directory and rejects missing addresses before funding.

Validated candidate: 6ccff70
Tree: f915bd95c390f4faabb19c0a17f5f88f9d01a6ce
Exact-head CI: https://github.com/agirails/sdk-python/actions/runs/42378341016

Validation:

  • GitHub functional unit tests pass on Python 3.9, 3.10, 3.11 and 3.12; SDK parity and property tests pass.
  • Fresh local full coverage run: 4103 passed, 1 skipped, 12 deselected; 85.04%, unchanged 85% threshold, cryptography 50.0.0.
  • GitHub coverage execution: 4101 passed, 3 skipped, 12 deselected. The job and its test step report success, but its log prints "FAIL Required test coverage of 85% not reached. Total coverage: 85.00%". Treat this rounding/boundary discrepancy as residual coverage debt, not as proof that the measured CI threshold passed.
  • Actual Python 3.9 new operator/ABI tests: 278 passed; compatibility set with cryptography 50.0.0: 651 passed; final additional behavior/recovery tests: 214 passed. Canonical/legacy wallet and cross-SDK/golden checks: 332 passed.
  • Real Web3 ABI encoding/decoding and local account signing exercise principal amounts, chain rejection, registry writes, release attestations, replay, failure recovery and transaction ordering. Controlled RPC substitutes are not a deployed EVM or live-chain proof.
  • Supplemental code-check from a635f24: 31 files, zero new violations, zero warnings, zero exceptions.
  • Separate pip-audit of all newly resolved runtime requirements: 58 dependencies, zero known vulnerabilities. CI's own pip-audit step is not reached after Bandit fails.
  • Final independent read-only Claude review found no blocking issue in the supplemental production diff. Claude did not execute the host's tests.

Owner-authorized CI debt:
Damir explicitly approved merge with the recorded CI debt. Repository-wide Ruff/format still fails. The supplemental fixes reduced comparable Ruff 0.15.16 diagnostics from 3671 to 3662; main had 3419, so the original integration also adds lint debt. CI installs a floating newer Ruff version. Five Bandit heuristics remain in four files verified byte-identical to main: serve.py, agirailsmd.py, proofs.py and validation.py. These reports are not represented as validated vulnerabilities. The borderline CI coverage diagnostic above is also recorded. Overall CI and Test Summary remain red.

No new lint waivers, coverage omissions, lowered thresholds, disabled checks, or bulk source reformatting were added. A broad cleanup attempt was rejected and removed before this final scoped candidate.

No PyPI publication, release tag, deployment, mainnet transaction, owner/key change or live paymaster activation is included. Live Base Sepolia, mutation, benchmark and integration jobs are skipped for this PR; no live-chain readiness claim is made.

Merge readback: main is 76854ab, with tree f915bd95c390f4faabb19c0a17f5f88f9d01a6ce identical to the validated candidate. The automatic post-merge Python SDK Tests run 42378892576 was deliberately cancelled to prevent its existing main-only benchmark auto-push to gh-pages under the no-deployment instruction. This is not a post-merge CI pass; the validation above is from exact-tree PR CI and isolated host runs. No checks or workflow definitions were disabled.

DamirAGI and others added 17 commits June 22, 2026 12:59
…2, 1:1 with TS

- AIRuling EIP-712 types + signer (agirails/types/dispute.py); reproduces the
  on-chain golden digest 0x9b4778...e365 (golden-vector test).
- Canonical evidence-bundle serializer + bundleHash (agirails/dispute/), byte-
  identical to the TS SDK; tiktoken for the >100k token cap.
- Dispute clients mirroring TS: BondEscalationClient, CompositeMediator + events
  (zero-remaining consumer rule), EvaluatorClient, UMAHelper, DisputeSplitIndexer
  (OQ-11 admin-CANCELLED counted equally), DisputeClient facade.
- 3 contract ABIs + network config; cross-SDK parity tests (surface == TS,
  descriptor/property-checked).
- pytest: 3495 passed / 43 skipped / 0 failed.

Branched off feat/ts-4.8.0-parity. Refs: DISPUTE SYSTEM/PRD (M1.5, M2).
Note: pyproject version still 4.8.0 vs TS 4.9.0 — version-parity is a separate follow-up.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
settleUMAAssertion + retryMediatorResolution (+ their events) were added to
BondEscalation.sol during the AIP-14b dispute-audit fix pass; re-vendor the
Python SDK copy so the ABI matches the deployed contract. Byte-identical to
the sdk-js copy (md5 227204e8...). ABI-only — no client code change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
BondEscalation gained on-chain prompt-CID governance (proposePromptCID /
executePromptCID / cancelPromptCID + activePromptCID/pendingPromptCID/
promptCIDUnlockTime getters + PromptCIDProposed/Updated/ProposalCancelled
events). Re-vendor the SDK copy to match the contract. Byte-identical to the
sibling SDK copy (md5 c2184425...); pure additions, no reformat. Parity green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… lockstep)

Brings python-sdk-v2 to parity with TS @agirails/sdk@4.9.0 (c3dab3e):
- version 4.8.0 -> 4.9.0
- kernel ABI re-vendored from artifact (99 entries, +recoverStalledInProgress/recoveryGrace/StalledInProgressRecovered); byte-identical to TS src/abi/ACTPKernel.json. bond_escalation/composite_mediator ABIs (prompt-CID, window 1) untouched.
- F-6 kernel-client helpers: recovery_grace(), get_recovery_deadline(tx), recover_stalled_in_progress(tx)
- networks Base Sepolia repointed to F-6 redeploy: kernel 0xD8f7..349B, vault 0xAf35..69eb, registry 0xDCcF..17Bc, archive 0x63B0..75AD; deploy block 43_262_304
- SDK-2: RequestResult.transaction.escrow_id added + populated from tx.escrowId
- SDK-1/D-2/F-5: no Python surface (RequestStatus model, no AA custom-kernel force-undefined path, no BuyerOrchestrator) = no gap.
compile clean, 262 kernel/request/level0/wallet tests pass. NOT published (publish gated post-merge -> post-audit).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rity follow-up)

Addresses Damir's deep-dive audit of bba4d41:
- version metadata: pyproject.toml 4.8.0 -> 4.9.0; version.py __version_info__ (4,8,0) -> (4,9,0) (both lagged the __version__ bump).
- F-5 (REAL gap, my earlier 'no Python surface' claim was WRONG): Python DOES have BuyerOrchestrator and it lacked the pre-escrow price-band guard. Added _check_provider_price_band (optional injected agent_registry, fail-open: no registry/read-error/no-descriptor/unparseable -> allow), called before create_transaction. Mirrors TS BuyerOrchestrator._checkProviderPriceBand. +7 tests.
- Re-verified directly (not from prior conclusions): D-2 genuinely no Python gap (config.actp_kernel_deployment_block flows to the scan floor in blockchain_runtime; no custom-kernel force-undefined like TS had). SDK-1 genuinely no swallow bug (_try_cancel is best-effort, TimeoutError raised after in the caller).
Follow-up: default CLI/client wiring of agent_registry (guard is present + injectable + fail-open today; cli/commands/negotiate.py constructs the orchestrator without a registry). 281 py tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Closes the last item from Damir's bba4d41 audit: direct unit tests for the F-6 recovery helpers (recovery_grace/get_recovery_deadline/recover_stalled_in_progress) and SDK-2 RequestResult.escrow_id passthrough. SCRATCHPAD Next Steps updated (metadata/tests/F-5 marked done; CLI agent_registry wiring left as follow-up). 5 new tests, all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…otiate CLI

Parity with the TS negotiate CLI wiring. Adds AgentRegistry.connect(network) read-only factory (no signer, account=None — view calls only) and the negotiate CLI now builds it for testnet/mainnet and injects it into BuyerOrchestrator so the F-5 price-band guard is active by default. Fail-open: mock mode / no registry / RPC error -> None, guard skipped. compile clean, 185 negotiation tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…t_at_amount (TS parity)

Damir's deep-dive caught the remaining gap: I had mirrored only TS's FIRST F-5 check (pre-create, buyer_orchestrator.py:588) but not the SECOND (TS BuyerOrchestrator.ts:1015-1030 in _commitAtAmount), so a multi-round counter could land on an out-of-band FINAL amount and Python would still accept_quote + link_escrow (lock escrow). Now _commit_at_amount re-checks the final amount against the provider band before accept+link; on out-of-band it rolls back to CANCELLED, records a rejected round, and returns (done, success=False). Fail-open when no registry (existing tests unaffected). +1 test. Both SDKs now guard at BOTH sites (pre-create + pre-commit) = full F-5 parity.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mirror the TS F-5 fix: quote_initial_bond now caps at MAX_ESCALATION_BOND like
the contract's _calculateInitialBond (was clamped to MIN only).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…iator)

Expose the 2026-07-02 Sepolia deployment (BondEscalation 0x62d5417B,
CompositeMediator 0xf8095f8d) on base-sepolia, matching the TS SDK.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-arg submit_ai_ruling

TS-parity port of the AIP-14c v2 SDK track (byte-identical golden digest 0xc14778...):
- 9-field AIRuling with evidence/reasoning ref hashes
- 64-byte (window, resultHash) delivery proof in all delivery paths (StandardAdapter,
  BasicAdapter, level1 agent, client.py); synthetic fallback result hash REMOVED —
  unified to the TS formula, fail-closed when no real result [BLOCKER-1]
- bond_escalation: 5-arg submit_ai_ruling + 2-CID escalate_to_uma
- agreement builder (D3 agreementHash preimage), serializer byte-identical to TS

Tests: 3525 passed / 0 failed.
KNOWN GAP: Schema-2.0.0 EvidenceArtifactV2 serializer exists only in sdk-js —
port before the joint TS/Py release (golden vectors in sdk-js tests/evidence-artifact-v2.test.ts).
NOTE: NOT yet published to PyPI (registry still at 4.8.0); ships with Faza-3.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
TS-parity re-point of BASE_SEPOLIA to the v2 redeploy (same addresses as sdk-js).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tical TS parity

Closes the release-blocker parity gap: ports the AIP-14c D5/D6 immutable evidence
artifact serializer to Python (strict validation, same frozen canonicalizer as the
1.0.0 bundle). Cross-SDK hash is BYTE-IDENTICAL to sdk-js for the golden artifact
(both: 0xa3678dfb781b297001e69c7830a27bd1ad53a6cd9b6951d96c77f318d33de926).

- validate_evidence_artifact_v2 / serialize_artifact_v2[_to_string] / compute_artifact_v2_hash
  / count_artifact_v2_tokens (mirrors sdk-js dispute/EvidenceArtifactV2.ts)
- rejects forbidden D6/D5 keys (reasoning/timeline) + any unknown key at any level;
  strict exact '2.0.0'; only carries delivery.encrypted when present (TS zod-passthrough parity)
- 6 golden-vector parity tests (same vectors as sdk-js tests/evidence-artifact-v2.test.ts)

Python dispute suite: 78/78.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Python3.11 suite:3607 passed,44 skipped,12 deselected; Python3.9 targeted66 passed.
Source content is identical to the independently inspected local testnet candidate.
Review snapshot SHA256: 2aca0aefed8f8df4f781a71c6a4b9fd4db20a225af6c57b8f48f6d5e7b9b514c

No deployment, package publication or mainnet activation is included.
External/runtime acceptance prerequisites remain separate.
@DamirAGI DamirAGI closed this Nov 7, 2026
@DamirAGI DamirAGI reopened this Nov 7, 2026
def do_GET(self):
if self.path.startswith("/redirect"):
self.send_response(302)
self.send_header("Location", self.path.split("?", 1)[1])
@DamirAGI DamirAGI changed the title Integrate verified Python dispute payments and async event compatibility Integrate verified testnet payment compatibility and Python operator fixes Nov 7, 2026
assert [fn.fn_name for fn,_ in decoded]==expected
assert all(call.target==REGISTRY and call.value==0 for call in batch['calls'])
if scenario=='A':
assert 'https://agent.invalid' in decoded[0][1].values()
@DamirAGI
DamirAGI merged commit 76854ab into main Nov 7, 2026
14 of 18 checks 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.

2 participants