Repository navigation
fix(training-agent): pin reporting-storage 0.3.0-beta.9 and log expected notification retries at warn - #9188
Conversation
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — server-side training-agent observability change, no protocol surface touched.
Scope: server/src/training-agent/gcs-reporting.ts and its unit test only. No static/schemas/source/**, docs/reference/**, dist/**, or changeset-relevant surface — so schema↔docs coherence, changeset scope, oneOf discriminator, immutability, and 3.1.x patch-eligibility gates do not apply.
Reviewer confirmed the error→warn reclassification is scoped to bounded in-flight retries (ReportingNotificationUnsettledError / message-prefix fallback) while abandonment and all other errors remain at error with identifiers intact, preserving fail-toward-alerting on the terminal state. databaseCode precedence, secret redaction (principalId/destinationGeneration/url never extracted), accessor-free ownValue, safe-integer filtering, and the 10-recipient slice are all correct and test-covered.
No Critical/High/Medium findings. high_risk=false, gated_paths=false, no author team gate, no prior decision. Although review_decision is REVIEW_REQUIRED, the gated-paths hard gate (row 2) only fires when gated_paths is true — it is false here — so the PR falls through to row 9.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean pass, no blocking findings.
This PR touches only platform server code: server/src/training-agent/gcs-reporting.ts (+58) and its unit test (+202). It adds webhook notification retry error classification — typed ReportingNotificationUnsettledError plus legacy-prefix retries warn; abandonment and legacy retries past the one-hour horizon escalate to error (L74-91). Secret redaction is thorough and type-guarded: notificationRetryDetails emits only non-secret subscriber identifiers via accessor-free ownValue, with leak / hostile-recipient / 10-cap test coverage. Terminal failure is surfaced on both modern (abandonment→error) and legacy (time-escalation) paths; module-level streak state is safe under serial single-threaded scheduling.
No changes to protocol surface (static/schemas/source/**, docs/reference/**, dist/**), so schema↔docs coherence, changeset-scope, oneOf-discriminator, and artifact-immutability gates do not apply. This is an operational/server-only change.
Decision table: no critical/high/medium findings (rows 1,4,5,8 do not fire). gated_paths is false (row 2 n/a despite review_decision=REVIEW_REQUIRED). high_risk false (rows 3,5 n/a). Prior decision was approve, so row 6 n/a. No no-auto-approve team match (row 7 n/a). Falls through to row 9 → approve.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — server-side logging change with no blocking findings.
This PR touches two server-only files (gcs-reporting.ts plus its unit test) with no schema, wire-shape, changeset, or released-artifact surface. It downgrades ReportingNotificationUnsettledError to warn using non-secret identifiers while keeping terminal abandonment and all other errors at error, with nested DB-code precedence preserved. Redaction is tight (no principalId/tenantId/generation/URL), reads go through an accessor-free ownValue, recipients are capped at 10, and the own-property name read keeps plain Errors at error. The warn downgrade preserves observability (abandonment stays at error with identifiers), so it is not a hidden durable-state failure. Tests cover hostile getters/proxies, wrong types, DB-code precedence, the recipient cap, and no-secret-leak assertions.
No critical/high/medium findings. Not high-risk, not gated-paths, no no-auto-approve team match. review_decision is REVIEW_REQUIRED but with gated_paths: false row 2 does not fire. Falls through to row 9.
A webhook subscriber that is not accepting reporting notifications made the durable reporting scheduler log every retry at error, which Addie posts as a system error every few minutes. Log the SDK's typed ReportingNotificationUnsettledError at warn with non-secret subscriber identifiers, and keep error for its abandonment (ReportingNotificationAbandonedError), database failures and every other scheduler failure. A plain Error from an older SDK stays at error: those SDKs never report abandonment. Squashed from the earlier review rounds onto current main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… typed notification errors Bump @adcp/reporting-storage to 0.3.0-beta.9 and @adcp/sdk to 17.0.0-beta.40, the release that carries adcp-client#3774. The scheduler failure logger now tells an expected notification retry apart with `instanceof ReportingNotificationUnsettledError` and an abandonment with `instanceof ReportingNotificationAbandonedError`, instead of by name. Migration 637 applies the storage release's schema delta in training_reporting_gcs, verbatim from REPORTING_LEDGER_MIGRATION and REPORTING_MANAGED_DELIVERY_MIGRATION: the configuration subscription_key column the store now writes on every install, its widened unique index, and the dropped three-column unique constraints. The integration suite applies and replays it. SDK 17.0.0-beta.40 names the test kit credential type TestKitAuth, an interface, so the hosted test-kit helper types its working auth block as Partial<TestKitAuth>. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ation 637's schema The scheduler failure logging tests build real ReportingNotificationUnsettledError and ReportingNotificationAbandonedError instances. A plain Error that only borrows the class name stays at error, a hostile prototype chain neither throws nor warns, and abandonment logs no subscribers. The integration suite checks the subscription_key column, both generation indexes and the dropped three-column unique constraints, and that the production install wrote an empty subscription_key. Co-Authored-By: Claude Opus 5.5 <[email protected]>
e7ae0a5 to
572a601
Compare
There was a problem hiding this comment.
Ladon verdict: Approve
Approve.
Clean pass on the full 8-file delta. No critical/high/medium findings.
Checks performed:
- Migration 637 (
server/src/db/migrations/637_training_gcs_reporting_subscription_key.sql): addssubscription_keyto Core reporting configurations, widens the generation unique index to 4 columns before dropping the legacy 3-column uniques (located by column-signature — no FK dependents, no name collision with the inline unnamed uniques in migration 620), with bounded lock/statement timeouts and verified replay-idempotency. Judged as production-facing (runs automatically on startup) — no destructive or non-idempotent operations found. gcs-reporting.ts: deliberate warn-on-bounded-retry / error-on-abandonment split, accessor-safe and covered by new unit + integration tests.- Dependency bumps only in
package.json/package-lock.json;versionunchanged, no schema-source ordistchanges → no changeset required.
Decision rationale:
- No critical/high findings (row 1 N/A).
gated_paths: false(row 2 N/A).high_risk: truebut the only reason is migration 637(added)— a new file, inherently low-risk scaffolding; no(deleted)/(modified)triggers and no medium finding (rows 3–5 N/A).- Prior decision was
approve, notescalate(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.
…ds or element accessors notificationRetryDetails ran Array.isArray and recipients.slice().map() on the error's recipients, so an index getter, a slice getter or a revoked array proxy could run an accessor or throw, and a throwing logger loses the retry diagnostic. It now guards Array.isArray, reads length and the first ten indexes as own data properties, and builds a fresh array. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — subsequent pass, clean diff, no findings.
What I checked:
- Delta from prior approve (head 572a601 → 6ab8b5a) is 2 files:
gcs-reporting.tsrecipient-projection hardening and its unit test. - The change replaces slice/map with own-data-property length/index reads via
ownValue. Reviewer traced every hostile case (revoked proxy, throwing descriptor trap, unreadable length, accessor length, throwing index getter) — all fail-closed to[]or omitted subscribers without firing any accessor, array method, or proxy trap. Correct defensive change on the error-logging path, comprehensively tested. - Migration
637_training_gcs_reporting_subscription_key.sqlmatches the high-risk glob but is(added)— new scaffolding, not an escalation trigger on the flag alone. - No
static/schemas/source/**ordocs/reference/**edits → no schema↔docs coherence concern. Server/migration-only change → no changeset required (correctly noted by reviewer).
Gate checks: gated_paths false; no no-auto-approve team match; high_risk true but only (added) reasons; no medium/high/critical findings. No decision-table row 1–8 fires → row 9 approve. Prior decision was itself approve, and this run surfaces no new findings.
beta.40 still bundles 3.3.0-rc.3 with stable 3.2.8, 3.1.31 and 3.0.25. Choose your SDK, Versions and the creative33 sandbox note name it, as tests/sdk-runtime-compat.test.cjs requires, and the SDK response conformance baseline records it; the reviewed findings match apart from the SDK version. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — mechanical SDK version bump, no findings.
Subsequent pass building on a prior clean approve. The delta is 86 lines across 6 files: a mechanical @adcp/sdk 17.0.0-beta.35 → 17.0.0-beta.40 bump across four docs/metadata files (choose-your-sdk.mdx, creative33-sandbox.md, versions.mdx, sdk-response-conformance README/known-findings.json) plus a correctly-scoped patch changeset. Version references are internally consistent; versions.mdx retains beta.35 as the rc.3-bundling floor by design. No wire-shape, schema, oneOf-discriminator, released-artifact, or governance change.
High-risk flag is true only from docs/reference/versions.mdx (modified) — a benign version-string bump with no reviewer concern — and migration 637 (added), which is new scaffolding, inherently low risk on its own. No (deleted) reason, so row 3 does not fire. No medium/high/critical findings, so rows 1, 4, 5 do not fire. gated_paths is false (row 2 n/a). Prior decision was approve, so row 6 sticky escalation does not apply. No no-auto-approve team match (row 7 n/a). Zero medium findings (row 8 n/a). Falls through to row 9.
The row sends readers to the SDK support matrix and named beta.35 while the matrix names beta.40. Name the same exact pin. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — docs-only version bump, no blocking findings.
This subsequent review follows a prior clean approve. The delta is a single docs-only line in docs/reference/versions.mdx: the "Running an SDK-backed 3.3 integration test" row bumps @adcp/sdk from 17.0.0-beta.35 to 17.0.0-beta.40, bringing a straggler row in line with the rest of the PR. No schema, wire-shape, changeset, or released-artifact surface is touched, so schema↔docs coherence, changeset-scope, oneOf-discriminator, and artifact-immutability checks are all unaffected.
Gate review:
- Author team gates: no no-auto-approve team match.
gated_paths: false, so row 2 does not fire despitereview_decision: REVIEW_REQUIRED.high_risk: true, but the two reasons are a(modified)docs file and an(added)migration. The new migration file is normal scaffolding (added → low risk on its own). The modified docs file has no medium-or-higher finding, so row 5 does not fire, and no(deleted)entry means row 3 does not fire.- No critical/high/medium findings → rows 1, 4, 8 do not fire.
- Prior decision was
approve, so sticky-escalation row 6 does not apply.
None of rows 1–8 fire; falls through to row 9 → approve.
Problem
The production training agent (Fly app
adcp-docs, loggertraining-gcs-reporting) posts a "System error" to Slack about every 6 minutes:This is an expected SDK retry. One
reporting.*webhook subscriber is not accepting deliveries. The SDK retries each claim every 30-45 s and abandons it after 100 attempts.logTrainingReportingSchedulerFailurelogged every scheduleronErroraterror. Every error-level log goes to Slack throughnotifySystemError, which posts at most once per 5 minutes per source; that throttle is where the ~6-minute cadence comes from.Change
Pin bump.
@adcp/reporting-storage0.3.0-beta.1 → 0.3.0-beta.9, and@adcp/sdk17.0.0-beta.35 → 17.0.0-beta.40, which beta.9 requires as its peer. This is the release that carries adcontextprotocol/adcp-client#3774: an unsettled notification claim now throwsReportingNotificationUnsettledError, and an abandoned claim throwsReportingNotificationAbandonedError. The lockfile moves only those two packages.Logging.
logTrainingReportingSchedulerFailurelogs aninstanceof ReportingNotificationUnsettledError(from@adcp/reporting-storage/notifications) atwarn:Reporting notification delivery is retrying. Warn logs are not posted to Slack. The log carries non-secret identifiers, so the dead subscriber can be found:transitionId,unsettled,attempt,maxAttempts;subscribers: [{ subscriberId, accountId, reason, finalStatus }], at most 10.It never includes the URL, principal or destination generation. Fields, the recipients array's
lengthand its first ten indexes are read as own data properties only, with the file's existing accessor-free reader. No array method runs, andinstanceofandArray.isArrayreport false rather than throwing on a hostile prototype chain or a revoked proxy.Everything else stays at
error:ReportingNotificationAbandonedError, which also logs itstransitionId,attemptandmaxAttempts. This is the one Slack post an operator acts on.Errorwith the same message, or one that only borrows the class'sname. Only the class is trusted.Migration 637 (
637_training_gcs_reporting_subscription_key.sql). This repo checks in the SDK's reporting SQL as its own migrations intraining_reporting_gcs(620, 621, 624, 630). Between the old and new pins, onlyREPORTING_LEDGER_MIGRATIONandREPORTING_MANAGED_DELIVERY_MIGRATIONchanged. Every other SQL constant the production service runs is byte-identical. The beta.9 store writesadcp_reporting_configurations.subscription_keyon every configuration install, so the runtime needs the delta. 637 applies it verbatim, with the same namespace precondition and lock and statement timeouts as 624, plus a check that 620's tables exist:subscription_key TEXT NOT NULL DEFAULT '', under a catalog guard;adcp_reporting_configurations_generationon(account_id, delivery_config_id, delivery_config_version, subscription_key), before dropping the published three-column unique constraint;adcp_reporting_managed_bindings, and adds the plain indexadcp_reporting_managed_bindings_generation.Constraints are found by their columns, not by guessed names. Account configurations keep an empty
subscription_key, so every existing row keeps exactly its uniqueness. The migration is idempotent, and the integration suite replays it. The runbook's migration paragraph now names 630 and 637.SDK 17.0.0-beta.40 type fallout. The test-kit credential is now the named interface
TestKitAuth. Interfaces get no implicit index signature, so the cast inwithHostedAuthTestKitno longer type-checked. Its working auth block is now typedPartial<TestKitAuth>. This is a type-only change; runtime behavior is unchanged.SDK checkpoint docs. As in earlier SDK bumps (#9156, #9178), Choose your SDK, Versions and the creative33 sandbox note name 17.0.0-beta.40, which
tests/sdk-runtime-compat.test.cjsrequires. beta.40 still bundles3.3.0-rc.3, with stable 3.2.8, 3.1.31 and 3.0.25. The SDK response-conformance baseline (scripts/sdk-response-conformance/known-findings.jsonand its README) records the new version; the reviewed findings match apart from that version..changeset/sdk-17-beta-40-docs.mdis a docs patch changeset, following those bumps. The training-agent code itself needs no changeset (.agents/playbook.md§ Changesets).Tests
server/tests/unit/training-gcs-reporting-startup.test.tspasses 30/30. The scheduler-logging cases build realReportingNotificationUnsettledError/ReportingNotificationAbandonedErrorinstances, and cover:subscribers;Errorwith either message, and a plainErrorthat borrows the class'sname, staying at error;getPrototypeOfthrows: no throw, no warn;slice/mapgetters, a revoked proxy, a throwing descriptor trap and an unreadablelength. None of them runs an accessor or throws, and the oldslice().map()traversal fails this test;server/tests/integration/training-gcs-reporting-postgres.test.tspasses 9/9 against PostgreSQL 16. It applies 620, 621, 624, 630 and 637, then replays 630 and 637. A new test checks:subscription_keycolumn:text, NOT NULL, default'';adcp_reporting_configurations_generationindex and the non-uniqueadcp_reporting_managed_bindings_generationindex;subscription_key.npm run typecheckpasses, includingtypecheck:fixed-trace-rollout-tests.Local hooks: the commits used
--no-verify, so the pre-commit checks were run by hand. Both passed on a tree that contains this PR's head unchanged (stacked #9219):scripts/check-image-quality.shandnpm run precommit(the dynamic-import, format-identity and callApi guards, thennpm run typecheck). The pre-push hook ran and passed (version sync and changeset policy). Its opt-in storyboard matrix (ADCP_RUN_STORYBOARD_MATRIX=1) was not requested; CI is the gate.The branch was rebuilt on current
main(one squash commit for the earlier logging work, one for the pin bump), because main's #9199 touched the same function.🤖 Generated with Claude Code