Skip to content

fix(training-agent): pin reporting-storage 0.3.0-beta.9 and log expected notification retries at warn - #9188

Merged
bokelley merged 6 commits into
mainfrom
fix/training-reporting-retry-noise
Nov 24, 2026
Merged

bokelley merged 6 commits into
mainfrom
fix/training-reporting-retry-noise

Conversation

@bokelley

@bokelley bokelley commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The production training agent (Fly app adcp-docs, logger training-gcs-reporting) posts a "System error" to Slack about every 6 minutes:

Durable reporting scheduler failed
diagnostic: Reporting notification delivery is not settled for 1 recipient(s); retrying

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. logTrainingReportingSchedulerFailure logged every scheduler onError at error. Every error-level log goes to Slack through notifySystemError, 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-storage 0.3.0-beta.1 → 0.3.0-beta.9, and @adcp/sdk 17.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 throws ReportingNotificationUnsettledError, and an abandoned claim throws ReportingNotificationAbandonedError. The lockfile moves only those two packages.

Logging. logTrainingReportingSchedulerFailure logs an instanceof ReportingNotificationUnsettledError (from @adcp/reporting-storage/notifications) at warn: 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 length and its first ten indexes are read as own data properties only, with the file's existing accessor-free reader. No array method runs, and instanceof and Array.isArray report false rather than throwing on a hostile prototype chain or a revoked proxy.

Everything else stays at error:

  • ReportingNotificationAbandonedError, which also logs its transitionId, attempt and maxAttempts. This is the one Slack post an operator acts on.
  • Any failure carrying a PostgreSQL SQLSTATE, including an unsettled error with a SQLSTATE cause.
  • A plain Error with the same message, or one that only borrows the class's name. Only the class is trusted.
  • Freeze-contract violations, retryable delivery-authority suppressions and every other scheduler failure.

Migration 637 (637_training_gcs_reporting_subscription_key.sql). This repo checks in the SDK's reporting SQL as its own migrations in training_reporting_gcs (620, 621, 624, 630). Between the old and new pins, only REPORTING_LEDGER_MIGRATION and REPORTING_MANAGED_DELIVERY_MIGRATION changed. Every other SQL constant the production service runs is byte-identical. The beta.9 store writes adcp_reporting_configurations.subscription_key on 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:

  • adds subscription_key TEXT NOT NULL DEFAULT '', under a catalog guard;
  • builds the unique index adcp_reporting_configurations_generation on (account_id, delivery_config_id, delivery_config_version, subscription_key), before dropping the published three-column unique constraint;
  • drops the same three-column unique constraint on adcp_reporting_managed_bindings, and adds the plain index adcp_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 in withHostedAuthTestKit no longer type-checked. Its working auth block is now typed Partial<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.cjs requires. beta.40 still bundles 3.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.json and its README) records the new version; the reviewed findings match apart from that version. .changeset/sdk-17-beta-40-docs.md is 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.ts passes 30/30. The scheduler-logging cases build real ReportingNotificationUnsettledError / ReportingNotificationAbandonedError instances, and cover:

  • the unsettled retry at warn, with the exact payload and no principal, generation or URL;
  • the final-attempt message from the real constructor, still at warn;
  • abandonment at error with its identifiers and no subscribers;
  • a database code taking precedence over the unsettled error;
  • a plain Error with either message, and a plain Error that borrows the class's name, staying at error;
  • a Proxy whose getPrototypeOf throws: no throw, no warn;
  • other failures staying at error;
  • hostile input on a real instance whose fields are redefined: throwing getters are never invoked, and wrong types are dropped;
  • hostile recipient arrays: an index getter, slice/map getters, a revoked proxy, a throwing descriptor trap and an unreadable length. None of them runs an accessor or throws, and the old slice().map() traversal fails this test;
  • recipients capped at 10, both by the constructor and by the logger on its own.

server/tests/integration/training-gcs-reporting-postgres.test.ts passes 9/9 against PostgreSQL 16. It applies 620, 621, 624, 630 and 637, then replays 630 and 637. A new test checks:

  • the subscription_key column: text, NOT NULL, default '';
  • the unique adcp_reporting_configurations_generation index and the non-unique adcp_reporting_managed_bindings_generation index;
  • that no three-column unique constraint remains on either table;
  • that the account configuration the production service installed carries an empty subscription_key.

npm run typecheck passes, including typecheck: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.sh and npm run precommit (the dynamic-import, format-identity and callApi guards, then npm 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

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Nov 23, 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 — 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.

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Nov 23, 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 — 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.

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Nov 23, 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 — 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.

bokelley and others added 3 commits November 24, 2026 16:28
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]>
@bokelley
bokelley force-pushed the fix/training-reporting-retry-noise branch from e7ae0a5 to 572a601 Compare November 24, 2026 16:37
@bokelley bokelley changed the title fix(training-agent): log expected reporting notification retries at warn fix(training-agent): pin reporting-storage 0.3.0-beta.9 and log expected notification retries at warn Nov 24, 2026
aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Nov 24, 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.

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): adds subscription_key to 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; version unchanged, no schema-source or dist changes → no changeset required.

Decision rationale:

  • No critical/high findings (row 1 N/A).
  • gated_paths: false (row 2 N/A).
  • high_risk: true but 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, not escalate (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]>
aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Nov 24, 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 — subsequent pass, clean diff, no findings.

What I checked:

  • Delta from prior approve (head 572a601 → 6ab8b5a) is 2 files: gcs-reporting.ts recipient-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.sql matches the high-risk glob but is (added) — new scaffolding, not an escalation trigger on the flag alone.
  • No static/schemas/source/** or docs/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]>
aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Nov 24, 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 — 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]>

@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 — 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 despite review_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.

@bokelley
bokelley merged commit 9f16842 into main Nov 24, 2026
72 checks passed
@bokelley
bokelley deleted the fix/training-reporting-retry-noise branch November 24, 2026 18:48
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