Skip to content

Add attempt-scoped Experiment readouts - #1513

Merged
Cedric Vidal (cedricvidal) merged 274 commits into
integration/taxonomyfrom
cedricvidal-experiment-readout
Dec 3, 2026
Merged

Cedric Vidal (cedricvidal) merged 274 commits into
integration/taxonomyfrom
cedricvidal-experiment-readout

Conversation

@cedricvidal

@cedricvidal Cedric Vidal (cedricvidal) commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds the built-in aggregate readout for canonical Experiments, carrying forward the useful #1053/#1495 implementation while replacing obsolete Submission identity and contracts.

  • Processes the immutable request/run vector for an exact experimentId + experimentExecutionId and preserves append-only JSON, derived Markdown, blob artifacts, stale/in-flight checks, cooperative supersession, and final atomic CAS publication.
  • Treats failed coding outcomes and passed:false observations as valid evidence; blocks only failed/dependency-blocked required observations while ignoring unrelated handler failures.
  • Adds exact-execution API, CLI, and Portal parity for report listing, structured artifacts, logs, retries, attempt selection, browser history, and deep links.
  • Organizes Experiment Detail into compact, URL-addressable Runs / Reports / Processing tabs directly below the global attempt selector. Runs uses the inset shared DataTable, Reports renders one persisted report type/version at a time with latest-safe defaults and compact history controls, and Processing owns handler progress, diagnostics, and retry/recovery. Completed, processing, blocked, failed, and no-artifact reports share one stable panel shell so identity, selectors, badges, and actions do not reflow when only the body state changes.
  • Keeps public terminology generic (Reports) and retains pp-readout only as the internal handler identifier.
  • Updates OpenAPI, architecture docs, deployment wiring, Storybook, and all affected static prompt inventory/adapters/datasets/contracts/rubrics.
  • Deliberately excludes Experiment report-template authoring, configuration, and triggering; those remain follow-up scope.

Demos

Before

N/A — this adds the first built-in Experiment report surface.

After

Two-take, attention-cued walkthrough of the real host Vite /experiments/:id route with deterministic browser-level API mocks: normal Scope shell/navigation, compact global attempt selector, above-the-fold Runs / Reports / Processing tabs, stable completed/failed report controls with body-only state changes, disabled unavailable artifact actions, inset exact-runs DataTable, persisted report types/history, and retry through processing to recovered publication.

experiment-report-stable-shell.mp4

Testing

  • pnpm build — passed across all 26 workspace projects.
  • pnpm test — 281 files / 3446 tests passed; one unrelated scripts/build-windows-worker.test.ts PowerShell subprocess timed out. The single targeted retry, pnpm exec vitest run scripts/build-windows-worker.test.ts, passed all 8 tests.
  • pnpm vitest run apps/portal/src/components/ExperimentReportCard.test.tsx apps/portal/src/pages/ExperimentDetail.test.tsx apps/portal/src/pages/ExperimentDetail.play.test.tsx apps/portal/src/components/ui/stories.play.test.tsx --reporter=dot — passed, 60/60 focused Experiment Detail/report shell unit/play/Storybook tests.
  • pnpm --filter portal build — passed.
  • pnpm --filter portal build-storybook --quiet — passed with stable completed, processing, blocked, failed, no-artifact, retry/error, report-history, multiple-report-type, stale-link, and exact-attempt stories.
  • pnpm eval:static-prompts:validate-data — passed; 223 approved cases and 16 quality targets validated.
  • pnpm --filter static-prompt-evals typecheck — passed.
  • pnpm --filter static-prompt-evals test — passed; 33 TypeScript and 94 Python tests.
  • pnpm eval:static-prompts:smoke — passed in offline smoke mode (execution check only, not a production quality acceptance).
  • pnpm --dir website test — passed.
  • cd website && pnpm run build — passed; documentation production build completed.
  • Focused API OpenAPI and CLI command snapshot tests — passed; generated website OpenAPI was refreshed.
  • Terminology/scope audit found no Submission identity or Experiment report-template authoring/configuration surface in the readout implementation.
  • Replacement walkthrough was recorded twice from the real host Vite route on exact pushed head 0e1a4d77ecd036d960117899e80159cd241831b5; take 2 validated as H.264/yuv420p, 1440×900, 25 fps, 39.16 s, fast-start. Full decode passed, the MP4 was opened, and representative completed, failed, processing, and recovered frames were inspected.
  • pnpm lint — unavailable because this branch/base has no installed or declared eslint executable (eslint: command not found); TypeScript builds passed.
  • Container validation — not completed. The full-stack build and one targeted reduced-stack retry both failed before services launched while the shared container VM committed image layers (no space left on device). Per the bounded retry rule, no further attempt was made. Project-scoped teardown then verified zero containers, volumes, and networks for scope-mt-app-8-cedricvidal-refactored-system; therefore there is no Compose five-run E2E evidence for this PR.

Documentation and compatibility

Updated docs/architecture/experiments.md, docs/architecture/post-processing.md, docs/architecture/prompt-evaluations.md, docs/architecture/overview.md, website/src/content/docs/guides/creating-experiments.mdx, ENV_VARIABLES.md, generated OpenAPI, and Compose/deployment wiring.

The new report APIs and CLI commands use exact Experiment execution identity. Generic report list parsers continue to accept the legacy { items, nextCursor } envelope as a compatibility fallback while preferring { data, nextCursor }. Portal links preserve executionId, tab, reportType, and reportId, with safe fallback for stale selections. No database migration or report-template contract is introduced.

Checklist

  • If Portal features changed, keep CLI capabilities in sync.
  • If Portal components changed, update their Storybook stories.
  • If database changes require a migration, include up() / down() and keep it CosmosDB-compatible. (N/A — no migration required.)
  • If dependencies changed, update the lockfile and regenerate NOTICE / NOTICE-REVIEW.txt with pnpm notice as needed. (N/A — no new third-party dependency.)
  • Video showing the behavior before the suggested change (N/A — new feature.)
  • Video showing the behavior after the suggested change

Cedric Vidal (cedricvidal) and others added 30 commits June 29, 2026 19:17
- routes/criteria: reject subject:run for gate criteria (400); allow run|
  iteration for observations on create + update
- llm: authoring assistant returns suggestedSubject; heuristic maps cross-
  iteration phrasing -> run, end-state/per-step -> iteration; defaults run for
  observations when the model is unavailable
- endpoints test: subject create + run-subject-gate rejection
- regenerated OpenAPI snapshot (subject enum + run-level observationResults)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- agent-trajectory: mergeTrajectories(list) concatenates calls in iteration
  order and unions tool definitions by id; fromAtifList helper
- index: accept atifUrls[]; download all + merge into the single
  AgentTrajectory (single atifUrl path unchanged)
- integration test: run-subject dependency_added_then_removed is false per
  iteration but true on the merged trajectory (GITHUB_TOKEN-gated)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…on (#1156)

- taxonomy-handler: resolve selected observations with their subject; split
  into iteration vs run buckets. Iteration-subject -> per-turn
  observationResults (unchanged). Run-subject -> evaluate once (final snapshot
  + every turn's atifUrl merged + full conversationHistory) -> run-level
  run.observationResults. Runs once because the handler runs once per run (the
  scheduler never sets message.iteration), so no idempotency guard needed.
- HandlerContext gains criteriaCollection so handlers can resolve criterion
  metadata by id; wired in post-processor + atif-handler test contexts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…#1156)

- wizard: Run/Iteration toggle (shown for observations, prefilled from AI
  suggestedSubject, user-overridable); subject in create payload + reset
- kind copy reworded to convey STEERING vs record-only: gate steers the agent
  (pass/fail feedback shapes its next iteration), observation records evidence
  never shown to the agent — in both the wizard and the inline editor
- RunDetail Taxonomy tab: new Whole-run observations subsection (from
  run.observationResults) above the per-iteration matrix, grouped by dimension
- CriteriaSubjectBadge on list + detail; subject in types + api payloads
- Storybook: subject-badge story

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…1156)

- yaml-mappers: round-trip subject
- criteria command: --subject <run|iteration> on create/update; show subject
  in list/get/export/import
- run-get-action: render whole-run run.observationResults block alongside the
  per-iteration ones
- updated cli-commands snapshot for --subject

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document the new subject discriminator, the kind-dependent default and gate
restriction, run-level run.observationResults storage, and the merged
whole-run trajectory evaluation across post-processing.md, app-design.md,
criteria-provider.md, and overview.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…versions

The autoBackfill feature re-processes historical runs when a handler version
bumps, enabling backfill of new/updated post-processing features across the
whole dataset. However, buildDispatchFilter() was excluding 'done' status
universally, preventing the version-check branch ($lt version) from matching
any historical runs.

This change makes status exclusions conditional:
- autoBackfill handlers exclude only ['queued', 'processing'], allowing
  done runs to qualify for version-based re-dispatch
- Non-backfill handlers still exclude 'done' (only dispatch on missing
  handler status)

Fixes regression identified in #1147 code review.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…/pp-dag-orchestration

# Conflicts:
#	packages/db-migrations/src/check-migrations.test.ts
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
loadHandlers() sits on the notify/poll hot path (2-3 reads per notify,
one per poll cycle) but the services collection only changes on deploys.
Cache the topology in-memory with a 60s TTL (configurable) to eliminate
nearly all of those reads — meaningful on CosmosDB where each query
costs RUs. registerHandler invalidates the cache after upserting so new
topology is picked up immediately; cycle-check validation reads fresh.

Addresses jduffney review feedback #4 on #1147.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…v-configurable

The scheduler is a singleton (replicas: 1, Recreate) and the sole writer of
the services collection, and registerHandler invalidates the cache on every
topology change — so cache coherence rests on invalidation, not expiry. A 60s
TTL sat barely above the 30s poll, forcing a needless fresh read on roughly
every other poll cycle. Raise the default to 5min (well above the poll
interval) and expose SCHEDULER_HANDLER_CACHE_TTL_MS so the TTL is only a coarse
backstop for out-of-band writes or a future scale-out beyond one replica.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Make explicit that process-local cache invalidation is only correct while the
scheduler runs as a single replica, and document the cross-replica mitigations
(Redis pub/sub or change-stream watcher, or a shorter TTL) required before any
scale-out.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Guards the singleton scheduler HTTP server against unbounded-memory
requests. Rejects oversized payloads with 413 Payload Too Large +
Connection: close, using a Content-Length fast-reject plus a streaming
byte-count cap for chunked/lying clients. maxBodyBytes is threaded
through createHttpServer so tests can use a small deterministic cap.

Addresses jduffney review feedback #5 on #1147.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The enqueue-before-claim refactor made the scheduler write a best-effort
handlerStatus.<id>.status="queued" marker in-process immediately after
enqueueing. The worker's claim filter excluded "queued", so once that
marker won the (near-certain) race against queue delivery, the worker
dequeued its own message, matched nothing on the atomic claim, logged
"no longer needed, discarding", and deleted the message — stranding the
run at "queued" forever (the 30s backfill poll also excludes "queued",
so nothing recovered it). This reintroduced the stuck-dispatch failure
mode via a new path.

Fix: remove "queued" from the worker claim exclusions so queued ->
processing is a permitted transition. Idempotency is preserved: still
exclude "processing" (another worker in-flight) and, for non-backfill
handlers, "done"; autoBackfill "done" stays gated by the version check.

Add a regression test asserting a run in the scheduler's "queued" state
is claimable and driven to done, update the existing filter-shape
assertion, and document that queued -> processing must be permitted.

Verified end-to-end against the docker-compose stack: a synthetic
status=done run dispatched via /notify/run-terminal now reaches
handlerStatus.pp-atif.status=done + reportsTriggeredAt, with duplicate
delivery still no-oping and the report trigger firing exactly once.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
`main` independently claimed 018/019/020 (backfill-criteria-gates,
backfill-task-prompt-type, create-codebase-indexes) after this branch had
assigned those numbers to the handler-DAG migrations, producing duplicate
prefixes once main was merged in.

Renumber the three handler migrations to sit after main's highest (024) so
prefixes are unique and monotonic:

  018-migrate-services-to-handler-dag -> 025-migrate-services-to-handler-dag
  019-add-handler-status-index        -> 026-add-handler-status-index
  020-backfill-handler-status         -> 027-backfill-handler-status

Class names are unchanged (mongo-migrate-ts tracks applied migrations by
className), and these migrations have not been applied to any shared
environment (int/prod migrations come from main only), so the renumber is
safe. Also updates required-migrations.ts, the internal [NNN] log prefixes,
and the db-migrations doc table.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve post-processing telemetry and migration sequence conflicts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a4e92f08-5d86-4664-b8de-1b99bcccc1cf
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ff08bace-4f82-42b3-9451-4063717e348f
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ff08bace-4f82-42b3-9451-4063717e348f
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ff08bace-4f82-42b3-9451-4063717e348f
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ff08bace-4f82-42b3-9451-4063717e348f
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 247cbe24-e22c-4f4c-b3e4-e71ce03f4669
Introduce stable submission identities, deterministic request/run vectors, resumable CAS rollover with immutable history, named-handler dependency evaluation, Cosmos-safe indexes, and attempt-scoped worker claim/completion helpers. Align the observation handler identity with the pp-observations dependency contract.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 99f84f04-d3b0-40f1-a254-4dfbd21e4d87
Finalize every native submit as an exact submission vector, recover interrupted final writes, reconcile and archive vector drift, dispatch only current attempts, and expose project-scoped submission detail, history, and retry APIs with polling repair.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 99f84f04-d3b0-40f1-a254-4dfbd21e4d87
Navigate successful submits to a Submission Detail shell, link grouped runs and run detail back to their parent submission, surface readiness and blocking pairs, and add CLI list/get/history/retry parity with Storybook coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 99f84f04-d3b0-40f1-a254-4dfbd21e4d87
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 99f84f04-d3b0-40f1-a254-4dfbd21e4d87
Introduce the Experiment aggregate, bounded request payload schemas, deterministic Cosmos-safe chunk routing/layout, persistence CAS and repair primitives, focused tests, and migration indexes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8fe76b9e-1205-4910-b51b-e8fa51538125
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Test Results (Node.js 22)

test: Run #697

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
4086 4078 0 8 0 0 0 1m34s

🎉 All tests passed!

Github Test Reporter

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 335776f5, after this morning's restack. Each finding below was re-checked at this head.

Inline findings:

  • [P1] A readout failure can write run-style fields onto the strict Experiment document, which then returns 500 along with its project's list page. The fix is likely small: opt into deferOnProcessingError like post-processor/report-generator, and move claimHandler() inside the try.
  • [P1] Readout evidence has no size limit: every ATIF trajectory of every run goes into one prompt.
  • [P2] New Portal links use ?execution=, but Experiment Detail reads executionId.
  • [P2] LogPublisher now adds runId to every live log line's data, which LogViewer displays.
  • [P2] A worker crash leaves pp-readout stuck in processing, with no recovery path and Retry disabled in the Portal.
  • [P2] Invalid references in the model output fail the readout without a correction retry.
  • [P2 · prompt boundary] No untrusted-evidence instruction, and no composition-contract row for the readout.

Not inline (the files aren't in this diff):

  • [P3] build-acr.sh:31 doesn't list readout in ALL_IMAGES, and get_dockerfile readout would resolve to the nonexistent apps/readout/Dockerfile, so this script can't build the new worker image.
  • Lockfile: the dotenv@16.6.1 entry added in this layer is a SHA-1 hash with an ms-feed-25 tarball URL. Most of the stack's feed entries are gone after the restack, and this one could be regenerated against the public registry too.

These parts look good:

  • the worker re-checks its claim between each expensive step and won't publish onto a superseded or frozen execution;
  • report documents are keyed per execution, so one attempt's readout can't overwrite another's;
  • every ID the model returns is cross-checked, and summary counts are computed in code;
  • the new experiment routes are all scoped by projectId + experimentId + experimentExecutionId;
  • Markdown goes through rehype-sanitize.

No new third-party packages.

Comment on lines +103 to +113
const claimed = await withRetry(() =>
store.claimHandler({
projectId: payload.projectId,
experimentId: payload.experimentId,
experimentExecutionId: payload.experimentExecutionId,
expectedExecutionVersion: payload.executionVersion,
handlerId: payload.handlerId,
handlerVersion: payload.handlerVersion,
claimToken: payload.claimToken,
})
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] A readout failure can write run-style fields onto the Experiment document, which then can't be read

claimHandler() runs outside the try that starts at L123. In the catch, currentClaimVersion() and completeHandler() can also throw. withRetry only retries Cosmos 429s, so any other Mongo error here goes to BaseQueueProcessor's failure path.

This payload has no runId, and the readout processor doesn't opt into deferOnProcessingError (only post-processor and report-generator do). It therefore falls through to the "Legacy fallback" (base-queue-processor.ts:397-409), which runs updateOne({ _id: documentId }, { $set: { status: "done", outcome: "failed", error, updatedAt } }) on experiments, the collection this processor is bound to.

ExperimentDocumentSchema is .strict(), so every later parse of that document throws:

  • GET /experiments/:id returns 500;
  • the project's experiment list page that contains it fails;
  • the coordinator's reconcile fails permanently for that experiment.

This is the first BaseQueueProcessor subclass bound to experiments, so the path is new in this PR.

Suggested fix: set protected override readonly deferOnProcessingError = true here, as the other two workers do, and move claimHandler() inside the try. Add a test where the claim throws a non-429 error.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 8104f68 and 1495652. A readout delivery no longer falls through to the run worker’s legacy failure writer. A pre-claim store error or an uncertain completion leaves the message available for recovery instead of marking the Experiment document failed. The queue-boundary regression injects those errors and checks that no run fields are written to the root.

For the two build notes in the review body: 893a44a adds readout to both ACR selection paths and uses the worker Dockerfile; 133d23d keeps dotenv@16.6.1 but restores its public-registry SHA-512 lock metadata. The build selection was tested without publishing an image.

Comment on lines +342 to +348
for (const { request, run, criterionIds: runCriterionIds } of exactRuns) {
const turns = run.turns ?? [];
const trajectories = await Promise.all(turns.flatMap(({ atifUrl, iteration }) => {
if (!atifUrl) return [];
return withRetry(() => this.blobStorage.downloadJson(atifUrl))
.then((trajectory) => ({ iteration, trajectory }));
}));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Readout evidence has no size limit, so readouts will fail on realistically sized Experiments

For every exact run, every iteration's ATIF trajectory is downloaded in full. composeReadoutUserPrompt() (prompt.ts:57-61) then puts the whole evidence object into a single user message with JSON.stringify, together with full request/run documents and criteria.

Experiments accept up to 250,000 requests, while the existing report worker caps file reads at 100 KB. A handful of runs with normal-size trajectories already exceeds the model's context window. Larger experiments also risk running the worker out of memory and issuing very large $in queries. When this handler fails, the execution's readiness becomes failed.

The system prompt also requires every run in the exact vector to appear once in runs, which can't fit in the output budget at scale.

Suggested fix: give the evidence a budget. Options include per-run digests (outcome, gate results and a trimmed set of trajectory highlights), a byte or token limit with explicit truncation markers, or tool-based on-demand fetching like the report generator uses. Add a test with oversized evidence.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 079fe58, 54f98be and 62c54af. The worker now computes the full manifest and rollups from paged exact-run reads and streams the artifact; the model sees the counts and a labeled sample, not the whole vector. At 250,000 synthetic members the output retained every pair, while the system + user prompt was 6,544 bytes. Reads were at most eight members per page. The manifest uses temporary disk proportional to population; this was not a Cosmos load test.

The 250,000-member check was synthetic. In a separate live two-run comparison on a887523f, both coding runs and both typed Taxonome results completed. The generic readout did not publish: its last model response failed citation validation, not a population or byte limit.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An update on the live failure I mentioned above: the corrected local stack candidate (f710ca1f) published the generic readout and both typed results for the same two coding runs. The failure was in excerpt matching, not the sample size. I also reran the separate 250,000-member synthetic case: it retained all 250,000 pairs, read at most eight members per page, and sent a 6,598-byte model prompt. That scale result is still a synthetic test, not a live Cosmos run.

Auto-replied by the GitHub Copilot app

Comment thread apps/portal/src/pages/ReportDetail.tsx Outdated
</Link>
{report.experimentId && report.experimentExecutionId ? (
<Link
to={`/experiments/${report.experimentId}?execution=${encodeURIComponent(report.experimentExecutionId)}&report=${encodeURIComponent(report._id)}`}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] These links use ?execution=, but Experiment Detail reads executionId

ExperimentDetail.tsx:217 reads searchParams.get("executionId"). It accepts both reportId and report (L220), but not execution.

The same ?execution= form is used here (L165, L369) and in:

  • ReportPreviewPanel.tsx:62
  • ReportsList.tsx:128
  • InsightDetail.tsx:220
  • RunDetail.tsx:262

Opening a report from an earlier attempt therefore lands on the current attempt. The reports query then loads that attempt's reports and the stale report= parameter is dropped, so the user sees a different attempt's readout, or "No report".

Suggested fix: write executionId= in all of these links, or have ExperimentDetail also accept execution. Add a test that navigates from ReportDetail to an earlier attempt.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

33f828c switches the callers to executionId and keeps old execution links readable. The combined stack also fixes the full-run View button: the URL retains the originating Experiment execution and the return state. The historical-navigation regression selects attempt A while B is current and checks the actual destination and selected report.

const channel = `logs:${requestId}`;
const redisLogEvent: LogEvent = {
...logEvent,
data: { ...data, runId },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Every live log line in the existing Portal log viewers now shows runId=<uuid>

Every Redis log event now carries data: { ...data, runId }. LogViewer.tsx:252-255 renders every data key except iteration, gate, final, phase and iterationHeader. As a result:

  • every live line in run, report and post-processor streams gets a runId=… suffix;
  • lines that previously had no data now render a data span;
  • blob replays don't carry it, so the same log looks different after a refresh.

Suggested fix: put the attempt key outside data (for example event.runId, with the SSE accepts filter reading it from there), or add runId to the LogViewer exclusion list.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

59e5b8d moves the attempt-routing ID into the private Redis envelope. The SSE subscriber still filters on the exact attempt, but routing no longer creates a visible data field or changes the rendering of a replayed line. A genuine application data.runId is preserved.

Comment on lines +114 to +120
if (!claimed) {
await log("info", "Discarding stale or duplicate readout message", {
experimentId: payload.experimentId,
experimentExecutionId: payload.experimentExecutionId,
});
await this.safeDeleteMessage(message.messageId, heartbeat.stop());
return;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] A worker crash during generation leaves pp-readout stuck in processing, with no recovery path

Generation can take minutes. If the pod dies, is evicted or is redeployed in that window, the queue redelivers the message. claimHandler() only claims from "queued", so the redelivery fails to claim, is treated as a duplicate and deleted here.

Nothing moves the handler out of processing:

  • the coordinator counts queued/processing as active (experiment-coordinator.ts:132-135);
  • there's no lease or timeout on the claim;
  • the Portal disables Retry while readiness is processing (ExperimentDetail.tsx:666).

The experiment stays "processing" until someone retries it through the CLI or API. The same pattern was raised on #1147 for run handlers. That PR now has stale-generation recovery for those, but it doesn't cover experiment handlers.

Suggested fix: allow the same claim token to reclaim processing after a lease expires, or have the coordinator reap stale processing experiment handlers.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8104f68 adds renewable ownership for pp-readout. The coordinator can recover an expired generation, but a delayed worker cannot renew, fail, or commit a report for its replacement. The test forces A to lose its claim, lets B take over, then delivers A’s late completion. 1495652 also repairs the public report from the winning durable reference if the worker dies between commit and publication. Old workers must be drained before enabling takeover.

Comment on lines +80 to +82
const result = readoutSynthesisSchema.safeParse(parsed);
if (result.success) {
return composeExperimentReadout(input.evidence, result.data);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] An invalid reference in the model output fails the readout with no correction retry

The 3-attempt correction loop covers JSON parse errors and Zod schema errors. composeExperimentReadout() at L82 runs outside it, and it throws on any unknown run, iteration, criterion, finding or action reference (readout-builder.ts:94-163). One hallucinated ID therefore fails the handler, and the execution's readiness becomes failed.

Suggested fix: catch these reference errors inside the loop and send them back as correction feedback, the same way schema errors are handled on L89-92.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1495652 puts semantic reference validation inside the same three-attempt correction budget as JSON/schema validation. An unknown run, criterion, iteration or finding reference can now be corrected; persistent invalid output fails without publishing. Store and transport errors aren’t treated as model mistakes.

Live result on a887523f: both agents passed, but the readout log recorded generation attempts 1/3, 2/3 and 3/3, ending with “Copy the excerpt verbatim from the cited evidence.” No generic report was published. The browser showed “No report available”; the separate typed JSON and Markdown did contain both exact attempts. This verifies that corrections are attempted and invalid output is rejected; it does not demonstrate successful recovery from that live response.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your point was about an invalid reference ID getting no correction attempt. I removed the separate verbatim-text check in the local follow-up (f32995c5); findings still have to cite the sampled request/run and a valid iteration or criterion when supplied. A faithful paraphrase or a different apostrophe no longer blocks publication.

I replayed all three responses from the failed run on the combined candidate (f710ca1f). All three passed on the first attempt. Substituting an unknown run ID still triggered correction; returning the same bad ID three times still failed. I then ran a fresh two-model Experiment: after fixing a missing storage container in my local setup and retrying the two coding runs, both passed and the generic report published four findings. I verified the generic and typed readouts in the Portal against the same two run attempts. The follow-up is validated locally, not yet pushed to this PR.

Auto-replied by the GitHub Copilot app

Comment thread apps/workers/readout/src/prompt.ts Outdated
Comment on lines +6 to +8
export const READOUT_SYSTEM_PROMPT = `You synthesize an Experiment benchmark readout from an exact immutable execution vector of Scope runs.

The user message contains JSON evidence for every request/run pair in that vector: task and profile metadata, the exact coding attempt and its gate results, criteria definitions, and any recorded per-iteration ATIF trajectories.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2 · prompt boundary] Untrusted run content reaches this prompt without being marked as untrusted, and the prompt-evaluation contract isn't updated

The user message is JSON.stringify(evidence), which includes user- and agent-controlled text: scenario.task, persona instructions, criterion prompts, observation feedback, and full ATIF trajectories (including repository and web content the agent read). Nothing in this system prompt says that evidence is untrusted data rather than instructions, unlike the Taxonome prompts.

Several things already limit the impact: no tools, schema validation, reference cross-checks, counts computed in code, and sanitized Markdown. A trajectory can still steer the narrative findings and the executive summary, though.

AGENTS.md requires the composition contract to be kept for any user-controlled text that reaches an AI. docs/architecture/prompt-evaluations.md has the inventory row (L34), but the "Exact production request composition" table (L149 onward) has no readout row, and there's no benign contract fixture.

Suggested fix: add an explicit instruction that evidence is untrusted, add the composition-table row, and add a benign contract case to readouts.jsonl.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1495652 marks benchmark evidence as untrusted in the system prompt and adds the production composition contract and offline fixtures. Corrections use a bounded, trusted diagnostic with the same evidence; prior model output is not replayed. Tools remain disabled and citations are checked against the sampled exact runs.

…ions

Use the existing required CI credential and advertised model catalog for both calls, and drain each case’s pool even on failure. Keep the production provider default, five cases, three CI samples, and strict majority unchanged.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Rotate the generation in the stored queued state before enqueuing recovery. A delayed renewal, failure, or report pointer from an expired owner cannot update its successor.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Keep durable status and report visibility fenced; defer uncertain storage writes and repair the committed report on redelivery. Build exact run manifests and counts in code. Bound and label sampled evidence, treat it as data, and give invalid model references the same bounded correction path as syntax and schema errors.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Keep verified members and profile membership on disk. Send only exact aggregates and bounded sampled evidence to the model, then stream all runs and profiles into the original artifact layout. Exercise 4,097 and 250,000 members without a population or artifact-size cutoff.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e767814e-3331-4a7e-ae96-15207b53ac9c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e767814e-3331-4a7e-ae96-15207b53ac9c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e767814e-3331-4a7e-ae96-15207b53ac9c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e767814e-3331-4a7e-ae96-15207b53ac9c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e767814e-3331-4a7e-ae96-15207b53ac9c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e767814e-3331-4a7e-ae96-15207b53ac9c
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Test Results (Node.js 22)

test: Run #721

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
4157 4149 0 8 0 0 0 2m2s

🎉 All tests passed!

Github Test Reporter

Validate the exact sampled identity and bounded excerpt, not whether the prose is a literal substring. Keep correction of invalid references within the existing three attempts.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

Test Results (Node.js 22)

test: Run #736

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
4166 4158 0 8 0 0 0 2m41s

🎉 All tests passed!

Github Test Reporter

@cedricvidal
Cedric Vidal (cedricvidal) marked this pull request as ready for review December 3, 2026 19:47
Base automatically changed from cedricvidal-experiment-foundation to integration/taxonomy December 3, 2026 20:09
Resolve the squashed-foundation conflicts using the clean merge with its tree-identical unsquashed tip. Preserve the reviewed 100-path readout patch.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@cedricvidal
Cedric Vidal (cedricvidal) merged commit 9a98792 into integration/taxonomy Dec 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: api Scope REST API, run orchestration, SSE streaming, and endpoints. area: cicd Build, test, release, and deployment pipelines. area: cli Scope command-line interface and terminal workflows. area: infrastructure Cloud resources, hosting, networking, and shared infrastructure. area: portal Scope web portal, pages, and user-facing components. area: post-processing ATIF generation and the run-output post-processing pipeline. area: reporting Generation and delivery of benchmark reports. area: shared Shared package: types, DB models, and queue/blob/redis clients used by all apps. area: website Scope documentation website (Astro) under website/. area: worker Coding agent worker runtime, task execution, and lifecycle. language: javascript Work involving JavaScript code, tooling, or dependencies. topic: testing Test coverage, test infrastructure, and validation quality. topic: ui Portal, visual presentation, layout, and interface components. type: dependencies Dependency additions, removals, and version updates. type: documentation Documentation additions, corrections, and improvements. type: enhancement New functionality or improvements to existing behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants