Repository navigation
fix(training-agent): report platform activations in get_signals readback - #7769
Conversation
get_signals built each signal's deployments from a single point lookup keyed on the training agent's own agent URL, so an activation to a platform destination (or any other agent) was never reported. That fails signal_marketplace/governance_approved at get_signal_deployment_readback once the storyboard runs routed. Readback now projects every live activation of the signal recorded in the caller's account-scoped session, most recent first, with the agent's own deployment still reported (not live) when nothing activated it. activate_signal keys activations per destination account so two seats on one platform are distinct deployments, and rejects platform or agent destinations with an empty identifier instead of storing them under the agent URL. Closes #7767 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — training-agent fix for get_signals readback missing platform activations.
The change makes the readback iterate the account-scoped session, filter live activations, and conform to core/deployment.json. The fix is well-tested (server/tests/unit/training-agent.test.ts) and touches only server-side task-handler logic — no protocol surface (static/schemas/source/), no docs/reference/, no dist artifacts, and no changeset-requiring surface, so no changeset is needed.
Medium findings
- server/src/training-agent/task-handlers.ts — activation-key-shape change silently no-ops deactivation for session state persisted before the deploy (non-blocking, single medium).
Only one medium finding, no blocking (critical/high) findings, high_risk is false, gated_paths is false, and the author is not on a no-auto-approve team. Rows 1–8 do not fire (a single medium is below the 3-medium threshold and is not in a data-loss/schema/infra category), so the outcome falls through to row 9: approve.
… shape Sessions persist across deploys, so an activation stored under the older account-less key would survive a deactivate issued under the new per-seat key, and a re-activation would duplicate it in readback. activate_signal now replaces and removes stored activations by their recorded segment, destination type, destination id, and seat account. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve
PR #7769 fixes get_signals readback to report platform activations in the sandbox training agent, touching only server/src/training-agent/task-handlers.ts and its unit test. No schema, task-definition, or normative-doc surface is modified, so the absent changeset is correct per the changeset-scope rule.
Reviewer confirmed a clean pass — no Critical/High/Medium findings. Verified: readback correctness, account-scoped multi-tenant isolation, empty-identifier guard, legacy-key migration, and the fictional-names rename.
Gate checks:
- No no-auto-approve team match (row 7 does not fire).
gated_paths: false— row 2 does not apply even thoughreview_decisionis REVIEW_REQUIRED.high_risk: false— rows 3/5 do not apply.- No medium findings — rows 4/8 do not apply.
- Prior decision was
approve— row 6 does not apply.
None of rows 1–8 fire; falls through to row 9 → approve.
…vations (#7773) report_usage validated signal_agent_segment_id with session.signalActivations.get(segmentId), but activate_signal stores activations under `${segment}:${destination}` (and, since #7769, `${segment}:${destination}#${seat}`). The bare-segment lookup never matched, so usage for any activated signal was rejected with SIGNAL_NOT_FOUND. report_usage now matches stored activations by their recorded segment through the same signalActivationMatches helper activate_signal uses for replacement and deactivation. A usage record identifies a signal only by account and segment (the schema has no destination field), so any live deployment of the segment in the record's account session satisfies it. Unknown, deactivated and other-account segments keep the same uniform SIGNAL_NOT_FOUND. Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Closes #7767
Root cause
handleGetSignals(server/src/training-agent/task-handlers.ts) built each signal'sdeploymentsfrom a singlesession.signalActivations.get(${segmentId}:${getAgentUrl()})lookup. The lookup only matched an activation to the training agent's own agent URL.activate_signalstores a platform destination under${segmentId}:${platform}, so it was never found. Readback therefore always returned the not-live agent deployment. That failssignal_marketplace/governance_approvedatget_signal_deployment_readback, which activates to{ type: "platform", platform: "pinnacle-dsp" }and then checkssignals[0].deployments[0].is_liveandactivation_key.The storyboard is correct:
deployments[]is where a signal is deployed (docs/signals/tasks/get_signals.mdx), andcore/deployment.jsonhas a platform variant. The fix is in the agent, and the storyboard is unchanged.Fix
get_signalsreadback: reports every live activation of the signal from the caller's session. Each entry has thecore/deployment.jsonfields for its variant:type,platformoragent_url,accountwhen set,is_live: true,activation_key, anddeployed_at. The most recent activation is atdeployments[0]. The agent's own deployment is still appended, not live, withestimated_activation_duration_minutes: 0, when nothing activated it. The output is byte-identical to before for a signal that was never activated or was activated only on the agent's own URL.activate_signalwrote to. Both use the samesessionKeyFromArgsderivation, so this change doesn't widen what a caller can see. A new test checks that one account's platform activation doesn't show up in another account's readback.activate_signalkey: activations are now keyed per destination account (${segment}:${destination}#${account}). Two seats on the same platform become two deployments instead of one overwriting the other. Destinations without an account keep the old key shape. Activation and deactivation match stored entries by their recorded segment, destination type, destination id and seat account, not by key. An activation persisted under the older key shape is therefore replaced on re-activation and removed on deactivation, never orphaned or duplicated.activate_signalguard: returnsINVALID_REQUEST(field: destinations[i].platformoragent_url) for an empty destination identifier. Previously a platform destination with an emptyplatformwas stored under the agent URL withdestinationType: 'platform'. The new readback would have exposed that as a corrupt deployment.the-trade-deskfixture in the platform-destination test is renamed topinnacle-dsp, per the fictional-names rule.This changes only the training agent. There are no schema, task-definition or normative-doc changes, so there's no changeset (
check-changeset-protocol-scope.cjspasses).Tests
New in
server/tests/unit/training-agent.test.ts(activate_signal handler):activated platform signal shows is_live true in subsequent get_signals: the issue's repro. It activatesshopgrid_category_buyertopinnacle-dsp/acme-seat, then asserts the exact platform deployment at[0]and that the not-live agent deployment is still reported.reports every live deployment, most recent first, and drops deactivated ones: an agent activation plus two seats on one platform, in most-recent-first order. After one seat is deactivated, only the other seat and the agent remain.replaces and deactivates platform activations persisted under the legacy account-less key: persisted-session compatibility. It fails when the destination matcher is disabled.does not report one account's platform activation in another account's readback: the cross-account isolation check.rejects a platform destination without a platform identifier.Three of the new tests fail on
main. The isolation test passes on both, which is expected because it guards against a regression.Local runs:
npx vitest run --config server/vitest.config.ts src/ tests/unit/training-agent tests/unit/comply-test-controller.test.ts tests/unit/storyboards.test.ts: 39 files, 1526 tests passednpm run typecheck: passednode --test tests/test-coverage-registration.test.cjs: 3/3 passedStoryboards (
TENANT_PATH=signals,dist/compliance/latest)main)signal_marketplacesignal_ownedsignals_baselinesignals_baseline/get_signals_asyncsignal_marketplace/governance_approved(unrouted)signal_marketplace/governance_deniedget_signals_pagination_integrityschema_validation_signalserror_compliance_signalswholesale_feed_signalswholesale_feed_signals_scope_isolationNo single-tenant storyboard reads back a platform activation today, so the unit tests are the direct regression guard.
Routed check with #7768's harness (local only, nothing pushed to #7768)
I applied #7768's
storyboard-runner-options.tsandrun-storyboards.tschanges locally and uncommitted, then ransignal_marketplace/governance_approved:@adcp/[email protected]as isget_signal_deployment_readbackfails with "Expected true, got false" and "Field not found at path: signals[0].deployments[0].activation_key"On rc.50 as is, the governance steps are skipped (adcp-client#3061), so
activate_signal_approvednever runs and the readback has nothing to find. The fix can't change that row.The bypasses were diagnostic only and were reverted afterwards:
requires_capabilityin the localdist/compliance/latestcopy.adcp_version/adcp_major_versionbefore the agent's payload-hash recompute.With both bypasses in place,
get_signal_deployment_readbackis the only remaining failure, and this PR fixes it.Out of scope, noticed
report_usagevalidatessignal_agent_segment_idwithsession.signalActivations.get(segmentId), but activations are keyed${segment}:${destination}, so that lookup can't match. It's unchanged here and worth its own issue.🤖 Generated with Claude Code