Repository navigation
fix(training-agent): echo package context on the inventory tenants - #9143
Merged
Merged
Conversation
Staging certification of both inventory tenants failed every buy family with "The seller did not echo the context unchanged on: create_media_buy (package context)". core/package.json requires sellers to preserve a package's context unchanged in responses and read surfaces; the inventory tenants dropped it. Store each package's context as sent on create_media_buy, replace it when update_media_buy sends one, and echo it on create_media_buy, update_media_buy and get_media_buys package rows. It is never read for business logic. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean app-only fix for the training-agent inventory simulator.
Checked:
- Scope is
server/src/training-agent/**plus a unit test — app code only, not the published protocol surface (static/schemas/source/**,docs/reference/**, dist artifacts, task defs). No changeset required; no schema↔docs drift; no dist-artifact mutation. - Change adds an opaque package-level
contextecho, implementing the existingcore/package.jsonfield. Writes store defensivestructuredClones guarded byisContext; reads echo viawirePackageacross create, update affected_packages, and get_media_buys. - New test covers create/read/update/re-read with nested data.
- No oneOf, transport/auth/signing, or breaking-class protocol change; no governance-precedent conflict.
Decision table: no critical/high/medium findings; gated_paths false; high_risk false; no no-auto-approve team match. Rows 1–8 do not fire → row 9 approve. (review_decision: REVIEW_REQUIRED does not block since gated_paths is false.)
KonstantinMirin
added a commit
to KonstantinMirin/adcp
that referenced
this pull request
Nov 21, 2026
Brings in 23 commits from main, among them the 3.2.12 hosted registration, the @adcp/sdk 17.0.0-beta.31 bump (adcontextprotocol#9132), the inventory-tenant creative library (adcontextprotocol#9116, adcontextprotocol#9143), the macOS runner tools for the release tests (adcontextprotocol#9138) and the hook split in adcontextprotocol#9126. The hooks stay as this branch has them: pre-commit runs the root suite, the staged-file-scoped server suite, the checks and the node:test files as one vitest run under a 120 s budget, and pre-push runs the storyboard queue under 180 s. With the shared workers, caches and queue, both fit in about 200 s on an M4 Pro, so this branch keeps the suites in the hooks. adcontextprotocol#9126's additive pieces stay: npm run verify:local and precommit-server-unit.cjs --full. Resolution ledger: - mechanical: package-lock.json -> main's (identical to main after the merge). - semantic: - package.json -> this branch's precommit script, plus main's verify:local. - .husky/pre-push (auto-merged) -> this branch's storyboard block; the matrix runs when its sources change, ADCP_SKIP_STORYBOARD_MATRIX=1 skips it. - .agents/playbook.md -> this branch's Local Hooks text, plus a verify:local paragraph; main's auto-merged hook description removed. - scripts/precommit-server-unit.cjs -> union: main's --full switch runs this branch's single-run full plan. - scripts/verify-local.cjs -> main's, with its header no longer saying the hooks run only fast checks. - server/tests/unit/training-agent-inventory-tenants.test.ts -> union: main's new cases with this branch's static import and state resets. - tests/cdn-artifacts, changesets-fence, maintenance-release-publication, release-publication-ordering -> union: this branch's git-env isolation, main's runnerPath() as the one GNU-tools mechanism; this branch's tests/helpers/gnu-tools.cjs and its shims are removed as unused.
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Staging certification runs 167 (inventory-adserver) and 168 (inventory-content) failed every buy family on the same check:
The buyer sends each package with a package-level
context(correlation values). The inventory tenants'create_media_buyandget_media_buyspackage rows came back without it.static/schemas/source/core/package.jsondefinescontextas "Opaque package-level correlation data echoed unchanged in responses, webhooks, and read surfaces", andmedia-buy/package-request.jsonsays the same on the request side.What
In
server/src/training-agent/inventory-sim/:create_media_buystores each package'scontextexactly as sent, as a structured clone.update_media_buyreplaces a package's storedcontextwhen the update sends one, and lists that package amongaffected_packages.create_media_buy,update_media_buyandget_media_buys) echoes the storedcontextunchanged. It is never read for business logic.get_media_buy_delivery'sby_packagerows have nocontextfield in the schema, so they're unchanged.Compliance coverage
Storyboards already assert the package-context echo:
pending_creatives_to_start,inline_creatives_without_syncandpackage_correlation_legacy_fallbackcheckpackages[0].context.buyer_refon create and read-back. The inventory tenants simply aren't in the training-agent storyboard CI matrix, so nothing graded them. Adding them is a separate, larger change.Tests
training-agent-inventory-tenants: 23/23. The new case sends a nested context (strings, numbers, null, false, arrays) and checks it comes back identical:create_media_buy;get_media_buys;update_media_buy'saffected_packages, with a replacement context;The responses validate against the canonical schemas, and the type check is clean.
🤖 Generated with Claude Code