Skip to content

x402 individual settlement updates#285

Merged
adambalogh merged 3 commits intomainfrom
ani/individual-settlement-updates
Apr 27, 2026
Merged

x402 individual settlement updates#285
adambalogh merged 3 commits intomainfrom
ani/individual-settlement-updates

Conversation

@dixitaniket
Copy link
Copy Markdown
Collaborator

  • version bump for og-x402
  • adds individual data settlement tx hash and blob id in generated output

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the SDK to a newer og-x402 version and extends generated LLM outputs to include per-request data settlement metadata (tx hash + Walrus blob id).

Changes:

  • Bumped og-x402 dependency version (and lockfile entries).
  • Added data_settlement_transaction_hash / data_settlement_blob_id fields to streaming and non-streaming output types.
  • Plumbed new response headers through the LLM client to populate the new fields (including final streaming chunk).

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
uv.lock Locks og-x402 to 0.0.2 and updates dependency constraints.
pyproject.toml Bumps og-x402 dependency floor to the new version range.
src/opengradient/types.py Adds new data settlement metadata fields to StreamChunk and TextGenerationOutput.
src/opengradient/client/llm.py Extracts settlement metadata from response headers and attaches it to outputs / final stream chunk.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/opengradient/client/llm.py Outdated
Comment thread pyproject.toml
Comment thread src/opengradient/types.py Outdated
balogh.adam@icloud.com added 2 commits April 27, 2026 14:04
@adambalogh adambalogh requested a review from Copilot April 27, 2026 18:08
@adambalogh adambalogh merged commit 079c389 into main Apr 27, 2026
13 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 289 to 292
return TextGenerationOutput(
transaction_hash="external",
data_settlement_transaction_hash=response.headers.get(X402_DATA_SETTLEMENT_TX_HASH_HEADER),
data_settlement_blob_id=response.headers.get(X402_DATA_SETTLEMENT_BLOB_ID_HEADER),
completion_output=result.get("completion"),
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

New behavior: the completion response now populates data_settlement_transaction_hash and data_settlement_blob_id from HTTP response headers. There are existing unit tests for LLM.completion, but none assert the header-to-output mapping when these headers are present—adding a test that sets these headers on the fake response would prevent regressions.

Copilot uses AI. Check for mistakes.
Comment on lines 543 to +545
if chunk.is_final:
chunk.data_settlement_transaction_hash = response.headers.get(X402_DATA_SETTLEMENT_TX_HASH_HEADER)
chunk.data_settlement_blob_id = response.headers.get(X402_DATA_SETTLEMENT_BLOB_ID_HEADER)
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

New behavior: the final streaming StreamChunk is mutated to include data_settlement_transaction_hash / data_settlement_blob_id from the response headers. The streaming tests currently validate TEE metadata on the final chunk but don't validate these new settlement fields—please add coverage to ensure they’re set correctly when the headers are provided.

Copilot uses AI. Check for mistakes.
Comment thread src/opengradient/cli.py
Comment on lines 417 to 423
print_llm_completion_result(
model_cid, completion_output.transaction_hash, completion_output.completion_output, is_vanilla=False, result=completion_output
model_cid,
completion_output.data_settlement_transaction_hash,
completion_output.completion_output,
is_vanilla=False,
result=completion_output,
)
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

The CLI is now passing data_settlement_transaction_hash into print_llm_completion_result, but the printer still only shows a transaction hash for is_vanilla flows and otherwise prints just Source: OpenGradient TEE. If the goal is to surface individual settlement metadata in the generated CLI output, update the print path for TEE results to display the settlement tx hash (and blob id when available) as well.

Copilot uses AI. Check for mistakes.
Comment thread src/opengradient/cli.py
result.chat_output,
is_vanilla=False,
result=result,
)
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

Same as completion: the non-streaming chat CLI now forwards data_settlement_transaction_hash, but the output formatter for TEE mode does not print it. To match the PR intent, the CLI should display settlement tx hash / blob id (when present) for TEE chat results too.

Suggested change
)
)
settlement_tx_hash = getattr(result, "data_settlement_transaction_hash", None)
settlement_blob_id = getattr(result, "data_settlement_blob_id", None)
if settlement_tx_hash:
click.echo(f"Settlement tx hash: {settlement_tx_hash}")
if settlement_blob_id:
click.echo(f"Settlement blob id: {settlement_blob_id}")

Copilot uses AI. Check for mistakes.
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.

3 participants