Skip to content

fix(compliance): make full verification resumable and bounded - #7854

Merged
bokelley merged 3 commits into
mainfrom
w-551/compliance-green-systemic
Oct 1, 2026
Merged

bokelley merged 3 commits into
mainfrom
w-551/compliance-green-systemic

Conversation

@bokelley

@bokelley bokelley commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Recent compliance heartbeats for slow sellers repeatedly timed out without an authoritative verdict. The registry kept showing the old badge date, and the owner retest button was paused because queued requests lacked durable authenticated credential provenance. The current sales_guaranteed storyboard requested a webhook even though its 3.x contract permits polling.

Changes

  • Restore owner/admin asynchronous retests with exact WorkOS credential and authorization epoch provenance, admission and completion guards, lease rechecks, a bounded global queue, and a resumable dashboard status URL.
  • Show the latest owner-scoped audit attempt, its coverage and first blocker; keep incomplete evidence from changing public badges. Scope failure details, observations, diagnostics, and grading comparisons to the selected owning organization.
  • Run scheduled heartbeats in two fenced slots with an adaptive 30-minute budget after a timeout or slow complete run. Allow three full suites total, reserving a slot for owner retests; use conditional claims and compare-and-set contention deferrals. Record peak process memory for capacity tuning.
  • Correct the 3.x sales_guaranteed test to exercise deterministic IO approval and get_task_status polling without requesting a task webhook. Validate the exact approved buy through readback. Materialize the sandbox buy before publishing task completion.
  • Add a feature-gated public HTTPS relay for the SDK's per-run webhook receiver. It is off by default pending staged Fly end-to-end validation; no 3.x webhook grade is changed here.
  • Document a proposed versioned 4.0 signed async webhook baseline. The inherited 3.x media_buy_seller synchronous-create scenarios still block guaranteed-only sellers; this needs a separate versioned baseline and runner change (#7852).

Evidence

  • Production read-only sample, Sep 24–Oct 1: 140 heartbeat records; 51 complete authoritative, 76 timed out across 10 slow agents, 13 incomplete from one agent. goTom's 20-minute owner run completed 68/74 storyboards and passed 51/51 core scenarios, but was audit-only.
  • Targeted training-agent sales_guaranteed: 14 passed, 0 failed, 0 skipped after removing unrelated non-guaranteed fixture seeding.
  • Focused unit tests: heartbeat/fences/dashboard (46), hosted relay (5); integration: publication (8), org-scoped verdict source (20), credential migration (11), owner refresh queue/API (72); TypeScript and compliance build checks pass.
  • Expert reviews covered capacity, buyer workflow, code correctness, and security. Follow-up fixes addressed org comparison isolation, controller coverage semantics, task completion ordering, callback query preservation, and expired migration leases.

Deployment / follow-up

  • Migration 599 safely terminalizes expired legacy leases and refuses to proceed with a live legacy retest. The current production read-only preflight found zero queued/running refreshes; recheck at deploy time.
  • Keep HOSTED_COMPLIANCE_WEBHOOK_RECEIVER_ENABLED off until a Fly smoke test proves public HTTPS callback ingress, signature validation, and cleanup.
  • The versioned signed webhook policy and receiver rollout are tracked in #7853.
  • Watch peak RSS, restarts, suite duration, and heartbeat due age for 24–48 hours before raising the two-heartbeat/three-total suite cap.
  • Owners must initiate their own retest with their authenticated session. A complete passing run is required for a public green badge; this PR does not predeclare goTom's result.

Open workspace in Conductor

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Oct 1, 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 — compliance refresh resumability/bounding work reviewed clean.

The reviewer examined all significant production files and found no Critical/High/Medium code defects. Authorization is consistently fail-closed with credential+epoch provenance enforced in code, a DB CHECK, and a trigger; heartbeats and owner refreshes have hard timeouts, lease rechecks, and global suite-slot fencing; compliance reads are org-scoped (tightening, not loosening). Schema↔docs↔openapi are coherent and the sales-guaranteed storyboard correction carries a correct patch changeset. No dist artifacts were mutated.

Checks against decision table:

  • No critical/high findings (row 1 N/A).
  • gated_paths is false (row 2 N/A).
  • high_risk is true, but all high-risk reasons are (added)/(modified) with no (deleted) entries, and no medium findings exist on modified files — rows 3–5 do not fire. New migrations 599/615 and the new hosted-webhook route are (added) scaffolding, not escalation-worthy on the flag alone.
  • 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.

Two non-blocking operational follow-ups (migration 599's fail-closed startup gate on a live retest; the off-by-default, unvalidated hosted webhook relay) are already documented in the PR and do not rise to medium.

Note: review_decision is REVIEW_REQUIRED, but gated_paths is false so the hard approval gate does not apply, and no Breaking-class protocol change is present (this is an app/server/operational change), so the Breaking-class human-ratification gate does not apply either.

@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 delta pass with no Critical/High/Medium findings. The reviewer confirmed:

  • server/src/training-agent/tenants/comply.ts — completionTaskScope change is fail-closed multi-tenant scope narrowing (owner scope preserved; accountId only narrowed via the trusted ingress operator_unit bridge, never widened), covered by the new mb_cross_unit_attack NOT_FOUND test.
  • server/src/routes/hosted-webhook-receiver.ts — safe type-narrowing refactor (byteLength equals length for Buffers).
  • sdk-runner test and compliance YAML fixtures internally consistent with the confirm_active→confirm_approved storyboard rename.

Decision-table walkthrough:

  • Rows 1 (critical/high): no findings → not triggered.
  • Row 2 (gated_paths): gated_paths is false → not triggered.
  • Row 3 (deleted high-risk path): all high-risk matches are (modified) or (added), no deletions → not triggered.
  • Rows 4/5 (medium findings): none → not triggered.
  • Row 6 (sticky escalate): prior decision was approve, not escalate → not triggered.
  • Row 7 (no-auto-approve team): no team match → not triggered.
  • Row 8 (≥3 medium): zero medium → not triggered.
  • Row 9: approve.

high_risk is true but the matched files are modifications/additions with no reviewer concerns and new SQL migrations are additions — per the high-risk-flag reading, new files and clean modifications are not escalation-worthy on the flag alone. Prior decision was approve for an earlier head; this delta remains clean.

Blocking findings: none.
Medium findings: none.

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.

2 participants