Repository navigation
feat(training-agent): support WorkOS buyer sign-in and keyless canary credentials - #8039
Conversation
…ning-buyer-sign-in
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — WorkOS Connect OAuth buyer sign-in for the training agent's canonical sales tenant.
This is an operational/app-scoped change touching server, scripts, docs/runbooks, and fly.toml. No protocol surface (static/schemas/source, docs/reference, task definitions, dist artifacts) is touched, so no changeset is required (operational-only). No schema↔docs coherence, oneOf discriminator, released-artifact, or 3.1.x patch-eligibility concerns apply. The auth boundary is well-constructed and heavily tested: RS256 verify pinned to issuer/JWKS/audience, ≤1h token age, before/after authorization-snapshot recheck, bans check, explicit-org-selector reconciliation, fail-closed 503 on dependency outage, rate limiting, raw-token suppression, bounded timeouts (WorkOS 10s, JWKS 5s, snapshot 2s). Login helper enforces PKCE/state, loopback callback, O_NOFOLLOW + 0600 storage, and serialized refresh rotation.
Medium findings
- server/src/training-agent/buyer-oauth.ts:116 — Buyer OAuth 503 outage branch has no observability (no logging/Sentry on the dependency-outage branch).
Decision: no critical/high findings (row 1 N/A); gated_paths false; high_risk false; the single medium is category observability, not data-loss/schema/infra (row 4 N/A); only 1 medium (row 8 N/A); no team gate. Falls through to row 9 → approve. Note: the author flagged this PR as not yet merge-qualified (stacked on #8012, CI pending retarget); that is a merge-readiness signal for humans, not an arbiter blocking trigger.
Medium findings
- server/src/training-agent/buyer-oauth.ts:116 — Buyer OAuth 503 outage branch has no observability
There was a problem hiding this comment.
Ladon verdict: Approve
Approve.
The delta since the prior approve is confined to fly.toml: it wires TRAINING_REPORTING_GCS_CREDENTIALS_FILE to a keyless external_account config staged via a new [[files]] block from the TRAINING_REPORTING_GCS_CREDENTIALS_BASE64 secret (guest_path matches the env var), and enables GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES for Fly OIDC. The executable-source flag is process-wide, but the only external_account JSON loaded is the controlled staged secret (passed as keyFilename), the whole path is gated behind TRAINING_REPORTING_GCS_ENABLED=false, and the keyless/no-ADC tradeoff is deliberately documented in the PR body. No new findings in this run.
The prior Medium (buyer-oauth.ts:116 — OAuth 503 branch observability) is outside the current delta and not rechecked per pass scope. No blocking findings, no medium findings in scope.
Decision rules: no critical/high findings (row 1 n/a); gated_paths false and review_decision APPROVED (row 2 n/a); high_risk false (rows 3/5 n/a); no medium findings (rows 4/8 n/a); prior decision was approve, not escalate (row 6 n/a); no no-auto-approve team match (row 7 n/a). Falls through to row 9 — approve.
…ning-buyer-sign-in
* feat(training-agent): add private GCS reporting with SDK 15.2 * fix(training-agent): provision reporting schema outside runtime boundary * fix(training-agent): isolate reporting readiness from liveness * docs(training): require reporting namespace before bootstrap * docs(deploy): require namespace before manual migrations * feat(training-agent): support WorkOS buyer sign-in and keyless canary credentials (#8039) * feat(training-agent): support WorkOS buyer sign-in for private reporting * fix(training-agent): bound buyer refresh and reporting requests * fix(training-agent): reuse short-lived WorkOS buyer tokens * chore(training-agent): stage keyless Fly reporting credentials * fix(training-agent): log sanitized buyer authorization outages * test(training): assert exact buyer request origins
Buyers without an organization API key cannot run the private reporting canary while key creation remains contained. This adds WorkOS Connect sign-in for the canonical sales tenant and a public PKCE buyer login helper. Reporting remains owned by the configured organization, and every request requires current direct WorkOS owner/admin membership plus an exact-credential local grant.
This PR builds on #8012 and targets its branch. Buyer OAuth and GCS reporting remain disabled. The Fly configuration mounts the staged dedicated external-account configuration at the explicit reporting credential path and permits its bounded Fly OIDC executable source. No private key or operator ADC is deployed.
The actual native issuer is
https://clean-gradient-46.authkit.app. A dedicated public PKCE client and explicit sales resource are configured. Real WorkOS code exchange, resource-bound refresh and RS256 identity/audience verification passed. The signed-in buyer currently has direct rolememberand no exact local owner/admin grant, so deployed admission is expected to be denied until the already-approved temporary access change starts. No WorkOS/local role changes have occurred.Live Google federation also passed: the WorkOS assertion exchanges into the separate keyless reader, which currently has no bucket permissions. Fly Google exchange and the exact four runtime storage permissions passed on all three current machines. Native runtime write/read/delete and actual deleted-generation 404 passed; listing, metadata mutation and IAM reads are denied; independent REST listing confirms no probe objects remain. Project/organization IAM is unchanged and neither account has user-managed keys. The corrected credential command is qualified through the actual Google auth parser and production Storage credential-file path, and staged without a deployment/restart (configuration SHA-256
cf1b65d11462916943a3d737aeba8b52db9e24adf3e6c15e36c02b392a224423).Validation:
67f485616: 1,106 root tests, all 746 server unit files (12,482 unique passing tests, 31 existing skips), both typechecks and boundary guards. Two HTTP teardown hooks exceeded their parallel wall-clock budget; the repository hook's supported isolated rerun passed all eight tests in those two files. No required check was bypassed. The merged lockfile includes main's proxy-addr 2.0.8 fix.The parent now uses reporting migration 620 after main claimed 619. All fresh-database entry points document mandatory namespace bootstrap even when reporting is disabled; the local procedure was executed against real PostgreSQL and preserved existing installation state while refusing an unexpected owner. The isolated namespace is provisioned on the managed primary. Both feature flags remain false; the approved 72-hour access window has not started; the reader's authoritative-prefix/deadline grant is unset. Reviewed deployment, live buyer admission, real canary delivery/recovery/capacity and business-generation revocation remain pending. This PR is not merge-qualified until its main-base checks and final review requirements pass.