Skip to content

feat(quotes): allow a per-transaction platform fee override on POST /quotes - #797

Open
jacklatourette wants to merge 3 commits into
mainfrom
jack/at-6193-platform-fee-override
Open

feat(quotes): allow a per-transaction platform fee override on POST /quotes#797
jacklatourette wants to merge 3 commits into
mainfrom
jack/at-6193-platform-fee-override

Conversation

@jacklatourette

Copy link
Copy Markdown
Contributor

What

Adds an optional platformFeeOverride object to the QuoteRequest schema (new components/schemas/quotes/PlatformFeeOverride.yaml, bundles regenerated).

When present, the override replaces all platform fees that would otherwise apply to the transaction:

  • platformFixedFee ({amount, currency}) and platformVariableFeeBps are both required within the object; negatives rejected at schema level (minimum: 0)
  • No standing fee config is required and there is no cap relative to one
  • USD source currency only today (including same-currency USD transfers); the fixed fee currency must equal the quote's source currency — 400 INVALID_INPUT otherwise
  • TRANSACTION_OVERRIDE is deliberately NOT added to config/FeeType.yaml: platforms must not create standing override configs via PATCH /config

No response-shape changes. Optional-field addition — passes the oasdiff breaking-change check.

Why

Grid Fees Phase 2d (AT-6193, epic AT-6136): platforms need per-transaction control of their own fee (promos, VIP pricing, negotiated rates) without editing standing config.

Sparkcore implementation: lightsparkdev/webdev stack for AT-6128 / AT-6194 (vendored client regen included there).

🤖 Generated with Claude Code

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
grid-flow-builder Ignored Ignored Preview Aug 7, 2026 6:34pm
grid-wallet-demo Ignored Ignored Preview Aug 7, 2026 6:34pm

Request Review

@mintlify

mintlify Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
Grid 🟢 Ready View Preview Aug 4, 2026, 5:34 PM

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

✱ Stainless preview builds for grid

This PR will update the grid SDKs with the following commit messages.

cli

feat(api): add platform-fee-override parameter to quotes/agents:me:quotes create

go

feat(api): add platformFeeOverride parameter to quote requests

kotlin

feat(api): add platformFeeOverride parameter to QuoteRequest

openapi

feat(api): add platformFeeOverride parameter to QuoteRequest

php

feat(api): add platformFeeOverride parameter to quotes create method

python

feat(api): add platform_fee_override parameter to quotes create method

ruby

feat(api): add platform_fee_override parameter to quotes create method

typescript

feat(api): add platformFeeOverride parameter to quotes create methods

Edit this comment to update them. They will appear in their respective SDK's changelogs.

🚧 grid-typescript studio

Your SDK build had a "fatal" conclusion, and no code was generated, but this did not represent a regression.

🚧 grid-openapi studio

Your SDK build had a "fatal" conclusion, and no code was generated, but this did not represent a regression.

🚧 grid-ruby studio

Your SDK build had a "fatal" conclusion, and no code was generated, but this did not represent a regression.

🚧 grid-go studio

Your SDK build had a "fatal" conclusion, and no code was generated, but this did not represent a regression.

🚧 grid-kotlin studio

Your SDK build had a "fatal" conclusion, and no code was generated, but this did not represent a regression.

🚧 grid-python studio

Your SDK build had a "fatal" conclusion, and no code was generated, but this did not represent a regression.

🚧 grid-php studio

Your SDK build had a "fatal" conclusion, and no code was generated, but this did not represent a regression.

🚧 grid-cli studio

Your SDK build had a "fatal" conclusion, and no code was generated, but this did not represent a regression.


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-08-07 18:35:47 UTC

@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds an optional per-transaction platform fee override to quote creation and regenerates both committed OpenAPI bundles.

  • Defines required fixed and variable override components with non-negative values.
  • Adds the override to the shared QuoteRequest contract.
  • Documents current USD and source-currency restrictions.
  • The shared request also exposes the platform fee capability on the agent quote endpoint, where no fee-control permission exists.

Confidence Score: 4/5

The agent-facing fee-control exposure should be resolved before merging because the shared request schema bypasses the intended platform-only contract boundary.

POST /agents/me/quotes consumes the modified QuoteRequest, so agents with only CREATE_QUOTES are now advertised as able to select platform fees even though the permission model provides no corresponding fee-control authority.

Files Needing Attention: openapi/components/schemas/quotes/QuoteRequest.yaml

Security Review

The shared QuoteRequest allows callers of the agent quote endpoint to submit platform fee overrides despite the agent permission model having no fee-management capability. The agent contract should omit this field or introduce an explicit authorization boundary before the capability is advertised.

Important Files Changed

Filename Overview
openapi/components/schemas/quotes/QuoteRequest.yaml Adds the fee override to a request shared by platform and agent quote endpoints, unintentionally broadening the advertised capability.
openapi/components/schemas/quotes/PlatformFeeOverride.yaml Defines the required fixed and variable fee override fields consistently with the stated optional request feature.
openapi.yaml Correctly bundles the new schema but consequently exposes it on every endpoint using QuoteRequest, including agent quote creation.
mintlify/openapi.yaml Mirrors the generated root bundle and publishes the same over-broad agent request contract.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  P[Platform caller<br/>BasicAuth] --> PQ[POST /quotes]
  A[Agent caller<br/>CREATE_QUOTES] --> AQ[POST /agents/me/quotes]
  PQ --> QR[Shared QuoteRequest]
  AQ --> QR
  QR --> F[platformFeeOverride]
  F --> C[Platform fee calculation]
Loading
Prompt To Fix All With AI
### Issue 1
openapi/components/schemas/quotes/QuoteRequest.yaml:70-71
**Agent fee authority is unguarded**

When an agent with `CREATE_QUOTES` calls `POST /agents/me/quotes`, the shared `QuoteRequest` advertises `platformFeeOverride` even though no agent permission grants fee control, causing either unauthorized platform-fee changes when honored or a broken generated-client contract when rejected. **How this was verified:** The agent endpoint references this shared request schema, while the complete agent permission enum contains no fee-management permission.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "feat(quotes): allow a per-transaction pl..." | Re-trigger Greptile

Comment thread openapi/components/schemas/quotes/QuoteRequest.yaml

@gcamata gcamata left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

a couple minor things but otherwise looks good!

Comment thread openapi/components/schemas/quotes/PlatformFeeOverride.yaml Outdated
Comment on lines +3 to +10
Overrides the platform fee for this transaction. When present, it replaces
all platform fees that would otherwise apply to the transaction — no standing
fee config is required. Only supported when the quote's source currency is
USD today; the fixed fee must be denominated in the source currency.

Only honored on platform-authenticated requests to `POST /quotes`. Agent
tokens carry no fee-control permission, so this field must be omitted on
agent-authenticated requests such as `POST /agents/me/quotes`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Overrides the platform fee for this transaction. When present, it replaces
all platform fees that would otherwise apply to the transaction — no standing
fee config is required. Only supported when the quote's source currency is
USD today; the fixed fee must be denominated in the source currency.
Only honored on platform-authenticated requests to `POST /quotes`. Agent
tokens carry no fee-control permission, so this field must be omitted on
agent-authenticated requests such as `POST /agents/me/quotes`.
Overrides the platform-collected fee for this transaction. When present,
it replaces any configured platform-collected fees that would otherwise
apply to the transaction. Currently only supported when the quote's source
currency is USD; the fixed fee must be denominated in the source currency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Applied your wording for the first paragraph. I kept the second paragraph about agent-authenticated requests since it addresses an earlier review finding — happy to drop it if you'd prefer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ya please drop it, I think it is confusing to talk about agents here

@ls-bolt

ls-bolt Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

🦣 Congratulations @gcamata - your substantive review earned a Bear-dog! (uncommon)

Neither bear nor dog, this heavily built carnivore belonged to its own extinct family.

View your Frost-dex: https://zeus.dev.dev.sparkinfra.net/#/dinodex/gcamata?section=ice-age

jacklatourette and others added 3 commits August 7, 2026 11:25
…quotes

Optional platformFeeOverride on QuoteRequest: when present it replaces all
platform fees that would otherwise apply — no standing fee config required
and no cap relative to one. platformFixedFee and platformVariableFeeBps are
both required within the object; negatives are rejected at schema level.
USD source currency only today (including same-currency USD transfers); the
fixed fee currency must equal the quote's source currency (AT-6193).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Agent tokens carry no fee-control permission, so note that the field
must be omitted on agent-authenticated requests like POST /agents/me/quotes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…platformVariableFeeBps at 10000

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jacklatourette
jacklatourette force-pushed the jack/at-6193-platform-fee-override branch from 829c5e1 to 7a9c7e0 Compare August 7, 2026 18:34

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

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