Skip to content

fix(training-agent): resolve comply_test_controller account_id targets and run server/src tests in CI - #7708

Merged
bokelley merged 2 commits into
mainfrom
fix/controller-account-resolution
Sep 29, 2026
Merged

bokelley merged 2 commits into
mainfrom
fix/controller-account-resolution

Conversation

@bokelley

@bokelley bokelley commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Why

comply_test_controller requests carry their own account object: an account_id plus the sandbox: true assertion the controller schema requires. The core AccountRef schema forbids sandbox on account_id refs, so the training agent's resolvers (canonicalizeAccountRef) threw on every controller call addressed by account_id. The SDK folds that error into "account unresolved" and refuses the call; see adcontextprotocol/adcp-client#3037. As a result, the 3.2 surface refused controller calls by account_id for every account, including the shared compliance fixture acc_luma_shared.

The test that exercises this, server/src/training-agent/tenants/account-change-feed-transport.test.ts, has been failing on main. Nobody noticed because no CI job or pre-commit run covers tests under server/src.

Changes

  • accountRefForResolution drops the controller-only sandbox assertion from account_id refs before canonicalizing. It applies only when toolName === 'comply_test_controller'; every other tool keeps strict core AccountRef validation. { account_id, sandbox: true } now resolves the same way { account_id } already did. The training agent is sandbox-only and treats every account as a sandbox account.
  • The opaque-account smoke test previously asserted that the controller refuses an opaque account_id sent with sandbox: true. That passed only because of the throw above: the same account without the flag already resolved. It's rewritten to assert what actually protects accounts, per-account isolation. A get_signals task the controller arms for one opaque account is invisible to another account (in get_signals and list_tasks) and is delivered only to the account that armed it. This matches the frozen 3.0 surface, where training-agent-3-0-compat-tools checks that controller calls for opaque accounts reach their handler and are isolated by resource (NOT_FOUND across accounts).
  • test:server-unit now includes src/, so the existing 4-shard CI job and the pre-commit server run cover the four server/src test files. Previously CI ran only tenant-smoke from there, via test:tenant-routing.

An earlier revision also limited controller targets to accounts the agent already held (synced or fixtures). That broke the 3.0 surface, where opaque accounts exist through use, so it was dropped.

Once #3037 is fixed in the SDK, the stripping step becomes redundant but stays harmless.

Testing (rebased on main, which now has @adcp/[email protected])

  • All server/src tests plus tests/unit/training-agent-product-coverage pass: 76 tests. That includes the shared-account controller test that fails on main and the rewritten isolation test.
  • All 11 training-agent integration files pass locally, 180 tests, including training-agent-3-0-compat-tools (8/8), which failed on the previous revision.
  • Typecheck passes.
  • On the previous revision, five storyboards that call the controller by account_id gave identical results with and without the change: reporting_core, reliable_reporting_managed_delivery, pagination_integrity_creative_formats, pagination_integrity_list_accounts, and media_buy_seller/account_change_feed. The full matrix is left to training-agent-storyboards.yml.

🤖 Generated with Claude Code

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Sep 28, 2026

@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 — narrowly-scoped training-agent fix, no blocking findings.

What I checked:

  • Change lets comply_test_controller resolve account_id targets by stripping the controller-only sandbox assertion before canonicalizing, while reinstating the fail-closed guard via isUnknownControllerAccount so unknown IDs resolve to null and hit the SDK sandbox gate.
  • Fail-closed behavior is covered by the PERMISSION_DENIED rejection test; principal-scoped isolation preserved.
  • Both resolvers patched symmetrically.
  • Diff is confined to server/** training-agent files plus package.json — app/operational, not protocol surface (static/schemas/source/**, docs/reference/**, dist artifacts). No changeset required.
  • package.json change is not a hand-edited protocol version bump.

Gate checks:

  • No critical/high/medium findings (row 1 N/A).
  • gated_paths: false — row 2 does not apply even though review_decision is REVIEW_REQUIRED.
  • high_risk: false; no deleted/modified sensitive files (rows 3–5 N/A).
  • No prior decision (row 6 N/A).
  • No no-auto-approve team match (row 7 N/A).
  • Zero medium findings (row 8 N/A).

Falls through to row 9 → approve.

bokelley and others added 2 commits September 28, 2026 07:02
…s and run server/src tests in CI

comply_test_controller requests carry their own account object: an
account_id plus the required `sandbox: true` assertion. The core
AccountRef schema forbids `sandbox` on account_id refs, so the training
resolvers' canonicalizer threw, the SDK folded the error into "account
unresolved", and every controller call addressed by account_id was
refused (adcontextprotocol/adcp-client#3037). The only thing keeping
unknown account_ids out was that same accidental throw, because the
resolvers synthesize a sandbox account for any ref.

- Drop the controller's `sandbox` assertion before canonicalizing, so
  the resolved account record, not the flag, decides sandbox status.
- Resolve controller account_id targets only when the seller holds the
  account (synced by the caller, or a compliance fixture), as the
  controller schema requires. Unknown account_ids still fail the gate.
- Include server/src in test:server-unit. The account-change-feed
  transport test that exercises this path lived under server/src, which
  no CI job or pre-commit run covered, so it broke on main unnoticed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…account isolation

Drop the known-account check. On the frozen 3.0 surface an opaque
account_id becomes real by use, and the controller must reach its
handler so resource isolation can answer (NOT_FOUND for another
account's media buy). The check refused those accounts at the gate and
broke training-agent-3-0-compat-tools.

Keep stripping the controller's sandbox assertion, so
{ account_id, sandbox: true } now behaves like { account_id } already
did. Rewrite the opaque-account smoke test to assert what actually
protects accounts: a controller-forced get_signals task armed for one
opaque account is invisible to another and is delivered only to the
account that armed it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[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 training-agent fix, no blocking findings.

This PR touches 5 files, all non-protocol: server/src/training-agent/** and package.json test scripts. It resolves comply_test_controller account_id targets by stripping the controller-only sandbox assertion before canonicalizing, scoped strictly to that tool via dispatch-set toolName. The rewritten isolation test verifies success plus per-account isolation across opaque accounts, and the test:server-unit widening closes a CI gap.

No changes to static/schemas/source/**, docs/reference/**, dist/**, or any wire-shape/changeset surface, so schema↔docs coherence, changeset scope, oneOf discriminator, and artifact-immutability gates do not apply. No hand-edited package.json version. Reviewer found no Critical, High, or Medium findings.

Gate checks: gated_paths is false; high_risk is false; author is not on any no-auto-approve team; no medium findings. Although review_decision is REVIEW_REQUIRED, row 2 only fires when gated_paths is true, so it does not apply. Falls through to row 9 → approve. Consistent with the prior approve on the earlier head.

@bokelley

Copy link
Copy Markdown
Contributor Author

Issue #7715 proposes fixing expect_account_change_webhook in the media_buy_seller/account_change_feed storyboard — same sales-tenant / acc_luma_shared surface as this PR; consider folding before merge or confirm follow-up.


Generated by Claude Code

@bokelley

Copy link
Copy Markdown
Contributor Author

Issue #7729 proposes a training-agent update_rights fallback lookup for operator_unit-isolated seeded grants — same surface as this PR; consider folding before merge or confirm follow-up.


Generated by Claude Code

@bokelley

Copy link
Copy Markdown
Contributor Author

Looked at #7729. Recommend follow-up, not fold.

The fix in #7729 is in update_rights's partition-lookup path — distinct from the accountRefForResolution stripping here. It introduces a new fallback with security guards (sandbox-only, controller-seeded, same-operator) that needs its own storyboard validation run. Folding it would invalidate the already-passing 180-test integration matrix on a diff that's otherwise clean and mergeable, and there's a #7715 fold candidate already pending on this thread.

#7729 is a clean standalone P1 on 3.2.0; it can land as its own PR off main once this one merges. Issue stays on 3.2.0.


Generated by Claude Code

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