Skip to content

fix(training-agent): inventory get_products rejects an account it never provisioned - #9149

Merged
bokelley merged 1 commit into
mainfrom
fix/inventory-unprovisioned-account
Nov 21, 2026
Merged

bokelley merged 1 commit into
mainfrom
fix/inventory-unprovisioned-account

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

On the inventory tenants (/inventory-adserver, /inventory-content), get_products with an account reference the seller never provisioned answered with products. It now fails with ACCOUNT_NOT_FOUND.

The accounts overview ("Account references before provisioning") requires this. A seller that exposes sync_accounts MUST reject a natural key it never provisioned and MUST NOT fall back to the public card. A public answer claims rate-card pricing for an account that does not exist.

#9146 found this: media_buy_seller/unprovisioned_account_reference failed 1P / 3F on both tenants.

Change

  • The inventory account resolver now runs the sales tenant's existing check, assertDiscoveryAccountProvisioned, on get_products, the one discovery task these tenants serve.
  • A synced natural key prices as before, with cache_scope: "account".
  • A call with no account still answers with the public card, cache_scope: "public".
  • Every other task keeps resolving any reference as before: create_media_buy, the controller, creatives.
  • Docs: the simulated-inventory page tells callers to sync_accounts before naming an account on get_products.

Effect on callers. Anyone who names an unsynced account on get_products now gets ACCOUNT_NOT_FOUND and must sync first. The Apostra storefront already runs sync_accounts first.

Tests

  • New test (training-agent-inventory-tenants.test.ts), run as the public test token, the flow a storefront runs:
    • an unprovisioned key gets ACCOUNT_NOT_FOUND twice, so the read did not provision it;
    • after sync_accounts, the same key gets cache_scope: "account";
    • with no account, discovery gets the public card.
  • Fails without the fix: with the resolver change reverted, get_products answers with products and the first assertion fails.
  • The suite's other tests now provision their account first, as a storefront does: 25/25.
  • media_buy_seller/unprovisioned_account_reference on /inventory-adserver, locally: 3P / 1S clean, up from 1P / 3F.
  • No regressions in the nine other storyboards that pass steps on the inventory tenants in ci(storyboards): grade the simulated inventory tenants #9146's CI run, re-run locally against this change. Same passing counts:
    • billing_gate_dispatch
    • capability_discovery
    • media_buy_seller/stable_account_id
    • notification_config_event_scope
    • notification_config_lifecycle
    • notification_config_rejections
    • security_baseline
    • v3_envelope_integrity
    • version_negotiation
  • npm run typecheck, compliance symbol links current.
  • After deploy: live check on a fresh demo caller. Unprovisioned key → ACCOUNT_NOT_FOUND; sync, then get_products → products.

🤖 Generated with Claude Code

…er provisioned

The inventory tenants resolved any account reference, so get_products with a
natural key no one had synced answered with products. The accounts overview
("Account references before provisioning") says a seller that exposes
sync_accounts MUST answer ACCOUNT_NOT_FOUND instead: falling back to the
public card claims rate-card pricing for an account that does not exist.

Apply the sales tenant's check (assertDiscoveryAccountProvisioned) to
get_products, the one discovery task these tenants serve. A synced key prices
as before, a call without an account still gets the public card, and every
other task keeps resolving any reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@aao-secretariat aao-secretariat Bot 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.

Ladon verdict: Approve

Approve — clean fix with no blocking or medium findings.

Scope: 3 files (app code + non-normative docs/building/** + a new unit test). No protocol surface, schema, or dist artifact changes, so no changeset required (repo rule: app/operational PR out of scope).

Checked:

  • InventoryPlatform.accounts.resolve now gates assertDiscoveryAccountProvisioned to get_products only, mirroring the established sales/v6 pattern (ctx.toolName confirmed populated by the SDK). account_id refs and no-account calls are unaffected; other tasks keep the lenient synthetic-account posture.
  • New test uses a distinct token and never-synced domain to genuinely exercise the unprovisioned path, asserts no-provision on read, and confirms account-scoped pricing after sync plus public card with no account.
  • Docs anchor #error-code-account-not-found resolves and matches get_products.mdx wording.

No critical/high/medium findings. high_risk=false, gated_paths=false, no no-auto-approve team match. review_decision is REVIEW_REQUIRED but gated_paths is false, so row 2 does not apply. Falls through to row 9.

@bokelley
bokelley merged commit 5e496c3 into main Nov 21, 2026
61 checks passed
@bokelley
bokelley deleted the fix/inventory-unprovisioned-account branch November 21, 2026 05:32
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 21, 2026
…count (adcontextprotocol#9149)

No conflicts. server/tests/unit/training-agent-inventory-tenants.test.ts
changed on both sides, and git's merge keeps both:
- this branch's top-level router import, loopback listener and per-test
  clock reset;
- main's per-describe account provisioning and its ACCOUNT_NOT_FOUND test.
  That test reads PUBLIC_TEST_AGENT_TOKEN, which this branch sets once per
  worker in server/tests/setup/revenue-tracking-env.ts.

Resolution ledger:
- mechanical: none
- semantic: none; the auto-merged test file was read and run (25 passed),
  including the clock tests, whose per-test reset_state keeps main's
  provisioned account

Check: typecheck passes, and the full server unit suite passes
(867 files, 14,705 tests, 31 skipped; main adds 1 test).
bokelley added a commit that referenced this pull request Nov 21, 2026
…'s principal

The inventory controller had no input schema, so the SDK stripped the
router-stamped __training_principal and seed_account provisioned the
fixture account for "anonymous". Since #9149 get_products requires a
provisioned natural key, every seeded storyboard's get_products then failed
ACCOUNT_NOT_FOUND (about 30 storyboards in #9150's first CI run). Use the
sales controller's input schema, which keeps that field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bokelley added a commit that referenced this pull request Nov 21, 2026
…enants, sharded storyboard CI (#9150)

* feat(training-agent): comply_test_controller seeds on the inventory tenants

The inventory tenants served only reset_state and sandbox_clock, so every
storyboard that seeds fixtures skipped as fixture_seed_unsupported. They now
serve seed_account, seed_product and seed_pricing_option.

- seed_account provisions through the shared account store, as on /sales.
- seed_product sells the fixture in the caller's market on the tenant called,
  on the season's own placements (video, audio or display; the nearest
  installment placement where the season has no such channel), so the engine
  forecasts, books and delivers it. Its wire shape is the fixture's own.
- seed_pricing_option prices a seeded product: floor_price is the auction
  bid floor, fixed_price the guaranteed rate.

Seeds live in the caller's market document, so reset_state discards them and
a caller that never seeds sees exactly the season's catalogue. The engine
sells extra products through a SeasonTraffic view that shares every cell and
day table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(training-agent): a seeded product whose channel the season lacks still gets placements

An audio fixture on the ad server found neither an audio channel nor an
installment channel, so it got no placements and seed_product failed
(media_buy_seller/metric_container_subsumption). Fall back to display, then
pre-roll, then any placement the season has.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(storyboards): split each inventory tenant across two isolated orchestrators

One inventory row ran 34-54 minutes against its 60-minute limit. Run each
tenant as two orchestrator jobs, the way /sales runs its eight: each runs
alternate shards of eight (--shard-group/--shard-groups on the isolated
shard coordinator), four at a time, and an aggregate job per tenant sums the
halves and enforces the floors under the existing
"Storyboards (current /<tenant>)" check. Each aggregate reads its own
orchestrators' status, so one tenant's failure never fails the other's
check. The rows leave the storyboards matrix, which returns to main's form
(30-minute limit, creative-builder the only isolated row), and the release
check expects the four orchestrator jobs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(changeset): inventory storyboard orchestrators

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(training-agent): inventory seed_account provisions for the bearer's principal

The inventory controller had no input schema, so the SDK stripped the
router-stamped __training_principal and seed_account provisioned the
fixture account for "anonymous". Since #9149 get_products requires a
provisioned natural key, every seeded storyboard's get_products then failed
ACCOUNT_NOT_FOUND (about 30 storyboards in #9150's first CI run). Use the
sales controller's input schema, which keeps that field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(storyboards): set the inventory floors from the seeded run

Run 44917374199 on a3d2006: /inventory-adserver 163/179 clean, 235
passed steps; /inventory-content 163/178 clean, 217 passed steps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(training-agent): the inventory public card never carries a caller's seeded products

get_products without an account built its forecast simulation with the
caller's seeded products, so the public card (cache_scope "public") listed
products only that caller had seeded. The public card is now the season's
products against an empty market, the same for every caller; seeded
products appear on account-scoped reads only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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