feat(research): retry failed experiment trials with retained history

This commit is contained in:
Boki 2026-10-24 10:56:58 -04:00
parent 6f64ef62ba
commit b373410320
32 changed files with 3336 additions and 61 deletions

View file

@ -1,14 +1,14 @@
{
"schema_version": 1,
"plan_revision": "2026-10-24.58",
"plan_revision": "2026-10-24.60",
"repository_base": "b7aeca4",
"plan_status": "twenty_seventh_wave_validated_uncommitted",
"plan_status": "twenty_eighth_wave_validated_awaiting_commit",
"execution_authorized": true,
"execution_scope": {
"authorized_by": "User: comit and continue after R12 handoff recommending bounded experiments and sweep UI",
"authorized_by": "User: commit and start after wave27 named safe failed-trial retries; prior slice committed6f64ef6",
"tasks": ["R06", "R07"],
"permissions": [
"Retained-input single-asset experiment and sweep UI components under pinned existing ADR-006; isolated implementation/review and full validation"
"Failed canonical experiment trial retry with immutable diagnostic receipts, SQL fencing and focused history/retry controls; isolated implementation/review and full validation"
],
"excluded": [
"performance_profiling_or_optimization",
@ -23,7 +23,6 @@
"multi_asset_activation",
"AI_execution_or_credentials",
"historical_binary_provisioning",
"failed_run_retry",
"cross_experiment_ranking"
],
"pending_policy_decisions": [
@ -1335,7 +1334,7 @@
"epic": "E6",
"priority": "P1",
"severity": "High",
"status": "in_progress",
"status": "review",
"dependencies": ["R01", "R10", "F08", "S02", "D01", "W03", "C06", "R12"],
"decision_dependencies": ["ADR-006"],
"task_file": "backlog/tasks/R06.md",
@ -1350,11 +1349,11 @@
"completed_commit": null,
"blocker": null,
"release_gates": [],
"integration_state": "partial_validated_uncommitted",
"integration_base": "30accfcf4370e96e58f771dff67639ea2a278188",
"integration_state": "validated_uncommitted",
"integration_base": "6f64ef62ba233b293ea1374c753bd0b467703792",
"worktree": "/home/boki/repos/stock-bot",
"execution_component": "Retained-input atomic bounded experiments",
"component_exclusions": ["failed retry and broader R05 cutover"],
"execution_component": "Failed-trial retry with immutable diagnostic history",
"component_exclusions": ["broader R05 source/default cutover, standalone or batch retry"],
"satisfied_component_dependencies": [
{
"task": "R05",
@ -1363,19 +1362,20 @@
}
],
"reviewed_by": "/root/r04_review",
"verification_reference": "ROADMAP.md#twenty-seventh-wave-handoff--2026-10-24",
"review_notes": "Retained-input component independently reviewed and fully integrated. Full task stays in progress for its recorded exclusions; no downstream task is silently released.",
"verification_reference": "ROADMAP.md#twenty-eighth-wave-handoff--2026-10-24",
"review_notes": "Retained-input experiment and retry acceptance complete; independently reviewed and all integrated gates passed. Awaiting owner acceptance/commit before downstream readiness changes.",
"implementation_slices": [
{
"owner": "/root/r12_backend",
"worktree": "/tmp/stock-bot-wave27.iR6JOC/backend",
"scope": "Atomic experiment service/routes, SQL22 admission/retention, compact summaries and API/PostgreSQL tests"
"worktree": "/tmp/stock-bot-wave28.AqRnN8/backend",
"scope": "Guarded manual retry service/routes, immutable SQL23 failure receipts, HTTP/native/PostgreSQL/Redis regressions"
},
{
"owner": "/root",
"scope": "Shared DTO/export, API/web composition, old migration fixtures, actual native browser workflow and planning"
"scope": "Shared DTO, migration allowlist/old fixtures, actual native browser workflow, integrated gates and planning"
}
]
],
"partial_commit": "6f64ef62ba233b293ea1374c753bd0b467703792"
},
{
"id": "R07",
@ -1398,26 +1398,27 @@
"completed_commit": null,
"blocker": null,
"release_gates": ["W04"],
"integration_state": "partial_validated_uncommitted",
"integration_base": "30accfcf4370e96e58f771dff67639ea2a278188",
"integration_state": "component_validated_uncommitted",
"integration_base": "6f64ef62ba233b293ea1374c753bd0b467703792",
"worktree": "/home/boki/repos/stock-bot",
"execution_component": "Same-experiment preview/progress/comparison UI",
"execution_component": "Per-trial retry controls and retained history",
"component_exclusions": ["cross-experiment comparisons and table performance measurements"],
"component_readiness": "May implement against root-pinned shared DTO; release requires accepted integration of R06 retained-input component. Full R06 is not claimed complete.",
"component_readiness": "Integrated against the validated R06 retry contract. Full R07 still excludes broader cross-experiment comparison and paused table rendering measurements.",
"reviewed_by": "/root/r04_review",
"verification_reference": "ROADMAP.md#twenty-seventh-wave-handoff--2026-10-24",
"review_notes": "Retained-input component independently reviewed and fully integrated. Full task stays in progress for its recorded exclusions; no downstream task is silently released.",
"verification_reference": "ROADMAP.md#twenty-eighth-wave-handoff--2026-10-24",
"review_notes": "Retry/history controls independently reviewed and all integrated gates passed. Broader comparison and paused table measurements remain outstanding; full task is not complete.",
"implementation_slices": [
{
"owner": "/root/r12_frontend",
"worktree": "/tmp/stock-bot-wave27.iR6JOC/frontend",
"scope": "Experiment editor/list/detail, browser client and focused interaction tests"
"worktree": "/tmp/stock-bot-wave28.AqRnN8/frontend",
"scope": "Failed-trial review/retry/history UI, frozen intent through refresh and ambiguous responses, interaction regressions"
},
{
"owner": "/root",
"scope": "Shared DTO/export, API/web composition, old migration fixtures, actual native browser workflow and planning"
"scope": "Shared DTO, migration allowlist/old fixtures, actual native browser workflow, integrated gates and planning"
}
]
],
"partial_commit": "6f64ef62ba233b293ea1374c753bd0b467703792"
},
{
"id": "R08",
@ -6581,7 +6582,7 @@
"One atomic expansion reuses existing durable runs/outbox; fixed input preview commitment prevents mutable-template drift. Financial and performance policies unchanged."
],
"twenty_seventh_wave_validation": {
"state": "validated_uncommitted",
"state": "validated_committed",
"scope": "R06/R07 retained-input components; both full tasks remain in_progress",
"integration_base": "30accfcf4370e96e58f771dff67639ea2a278188",
"log_directory": "/tmp/stock-bot-wave27.iR6JOC",
@ -6673,6 +6674,97 @@
"Chromium only; existing bundle-size/Rust warnings remain. No performance profiling/optimization/benchmark runs, new-wave commit, push or PR."
],
"cleanup": "Both exact --rm disposable PostgreSQL/Redis containers stopped successfully. 35 authored source/test files archived and hashed. Worktrees/logs retained; development/production services and data untouched.",
"next": "Finish R06 failed-trial retry as a narrow durable-state change: retain prior diagnostics, keep immutable logical trial inputs, create a new fenced attempt only for failed runs without results, and reject completed/cancelled retries. Reuse existing lease/outbox machinery and expose truthful retry controls after backend integration. Keep performance paused and other release gates intact."
"next": "Finish R06 failed-trial retry as a narrow durable-state change: retain prior diagnostics, keep immutable logical trial inputs, create a new fenced attempt only for failed runs without results, and reject completed/cancelled retries. Reuse existing lease/outbox machinery and expose truthful retry controls after backend integration. Keep performance paused and other release gates intact.",
"completed_commit": "6f64ef62ba233b293ea1374c753bd0b467703792"
},
"twenty_eighth_wave": ["R06", "R07"],
"twenty_eighth_wave_base": "6f64ef62ba233b293ea1374c753bd0b467703792",
"twenty_eighth_wave_notes": [
"One manual retry receipt also retains the prior failure; both observed lifetime attempt and manual-retry counters identify the failure including preclaim errors.",
"Original input/review snapshot remains immutable; fresh retry requires current approval and records its receipt separately. Existing lifetime automatic recovery budget remains unchanged."
],
"twenty_eighth_wave_validation": {
"state": "validated_uncommitted",
"scope": "R06 retained-input experiment acceptance complete; R07 retry/history component complete, broader task partial",
"artifacts": "/tmp/stock-bot-wave28.AqRnN8",
"source_archive": "/tmp/stock-bot-wave28.AqRnN8/validated-source.tar.gz",
"source_files": {
"apps/stock/config/src/contracts/experiments.ts": "9bea8dc6ef3557912a46b3516670f8857654834f494cb9aaa34e51366d9bb223",
"apps/stock/web-api/src/migrations/migration-runner.ts": "671a719e189c42931e3b4107a21480ac66d4400c525b95ade4d4285346952370",
"apps/stock/web-api/src/routes/experiments.routes.ts": "560ccd8577fc73355aec1b91ad3235e5d3d3bd660cc0e25e12e783387f0d9e3e",
"apps/stock/web-api/src/services/experiment-retry.ts": "9a44aa7dfe875d7b66b9715df6f5ae1b7eaccb2c5e1ad61bbfa32e9f11d1b3f0",
"apps/stock/web-api/src/services/experiments.service.ts": "bfcf8d8034992278f539fda3744c65bc31754279b7c8bdd6acd1a0e625e22475",
"apps/stock/web-app/src/features/experiments/ExperimentDetailPage.tsx": "f0827a1e50cd23a5f1aabd308de0368511a6b8dd72a88d4876bb1a0c6f45c82e",
"apps/stock/web-app/src/features/experiments/components/ExperimentTrialRecovery.tsx": "5e4016ce052e6e14ba5f3679777523ca2511ad087987b44505e4a147195acd51",
"apps/stock/web-app/src/features/experiments/services/experimentApi.ts": "b145996dede2ecb0838f1641029d82d8313d54b9189bf898ebbfe79ca4d1fdc7",
"database/postgres/init/23-experiment-retries.sql": "f19b7cf759a71cd3eeb55d0a0ca84a386d32fb0cad062e034901dfce96bbadd2",
"test/e2e/fixture.ts": "bf25802f3aa0c43d2229f658eb7c64ab99fef5d7320b1247faa36c7861d4198c",
"test/e2e/workbench.test.ts": "ee52abf3732340582c19e5e1479cc7a4a01fb7ac68904ce9946c1737596f9355",
"test/integration/experiment-retries-api.test.ts": "0228c9315a72a987473a3a0702af3ceecdebb547ffbd6fd7cd64b3945db44b82",
"test/integration/experiment-retries-ui.test.tsx": "6232596fb63842e5cf2759b379d776aa010a0be67325354052530b0f41cf3c88",
"test/integration/experiments-api.test.ts": "98caacdae9d30b5a5d6da113eabd07477494a6e238213c0dd8934b3adedfea5f",
"test/integration/experiments-ui.test.tsx": "3aa2f144b7d3bb4f122fe4a8031cff0b410bef9fa6d63b0fd1329204a9e96c2e",
"test/postgres/canonical-durable-backtest.test.ts": "9281282c6c84c75291cdade49e787b3a8c6b5f312c471829a01b060d75dfd0bc",
"test/postgres/canonical-research.test.ts": "95ceffc10022315119a9836352a7381f348900bc243789a5a19c79b313681545",
"test/postgres/catalog-backtest-drafts.test.ts": "5f16f9e917838af049ad1dcc54cf4cbab2176a42ecfd2606125071e9056df356",
"test/postgres/dataset-catalog.test.ts": "60202d147c978277ed1daf7f0b584fb89d987e8fa64ec2a19e0a7fd84568e12f",
"test/postgres/durable-backtest.test.ts": "3f1364982fbb3b1d6668fb91ae834f9853739b67f743586b6484c54a1f0c6015",
"test/postgres/experiment-retries.test.ts": "821f8b6a7407b9b16cad906519a649e8ad0f0e96312cb3252e8fe3fc2b069e4f",
"test/postgres/experiments.test.ts": "1b1eb3ea3cd778f72c471f8f971320fbc23222ac3fc3c470f450b8c75356d90d",
"test/postgres/migration-runner.test.ts": "b368039e030c5e1a1d71b12a17556e2e0267855a7a35215fd9a06675a783175d",
"test/postgres/research-retention.test.ts": "b47c24af8da0e182fad9f467519e33711fbcf7407bcd36565929d01f79f87a51",
"test/postgres/research-runtime-isolation.test.ts": "5b078b6c9fd33f329309c3a9a162432175cef254aef103b6125980f953a7552a",
"test/postgres/research-workspace.test.ts": "a2a386c4aca55e344767a9e71664b176b164e031cf9717e7de0f0efe534c30be",
"test/postgres/run-reproduction.test.ts": "16cdd2c8e0a014033260713cb139241965b8478eec72b55a1df2096397a915c2"
},
"checks": [
{
"command": "CARGO_BUILD_JOBS=2 bun run check",
"log": "/tmp/stock-bot-wave28.AqRnN8/check.log",
"outcome": "All repository gates passed: build/source/contracts/secrets/lint; 93 tooling, 43 utility, 44 calculation, 738 integration and 150 Rust tests (4 existing manual Rust ignored); zero failures."
},
{
"command": "PIPELINE_TEST_DATABASE_URL=<disposable PG> BACKTEST_TEST_REDIS_URL=<dedicated Redis /15> bun run test:postgres",
"log": "/tmp/stock-bot-wave28.AqRnN8/postgres.log",
"outcome": "190 tests / 1609 assertions passed across 21 files. New focused retry suite11/101 covers exact timestamp/history retention, preclaim0 recurrence, stale callbacks, same/cross-parent receipt races, cancellation/archive/build gates, SQL tampering/rollback, Redis outage/native recovery and first/idempotent migration preservation."
},
{
"command": "PIPELINE_TEST_DATABASE_URL=<disposable PG> BACKTEST_TEST_REDIS_URL=<dedicated Redis /15> bun run test:e2e",
"log": "/tmp/stock-bot-wave28.AqRnN8/e2e.log",
"outcome": "11 Chromium workflows / 285 assertions passed. New workflow records a real durable failed attempt, retries through the UI after mutable template/review changes, completes original inputs through Rust, replays the receipt after completion, checks exact timestamp/history and reopens the result. All 10 previous workflows passed."
},
{
"command": "bunx tsc --project /tmp/stock-bot-wave28.AqRnN8/tests-tsconfig.json --noEmit",
"log": "/tmp/stock-bot-wave28.AqRnN8/integrated-test-types.log",
"outcome": "Strict new/changed tests and dependent sources passed."
},
{
"command": "bunx eslint <shared DTO/new retry tests/changed browser test> --max-warnings 0; bunx prettier --check <all changed TS/TSX/JSON>; git diff --check",
"log": "/tmp/stock-bot-wave28.AqRnN8/integrated-test-lint.log",
"outcome": "Scoped test lint, all changed source formatting and whitespace checks passed; final planning formatting checked separately."
},
{
"command": "CARGO_BUILD_JOBS=2 bun run --cwd apps/stock/engine build:release",
"log": "/tmp/stock-bot-wave28.AqRnN8/native-release.log",
"outcome": "Release addon restored before PostgreSQL/browser gates. SHA256 ef00eed556f5c32332d36a9a00ef710682e90deb00b54552e4b5c8bfdfbe8103 matches previous wave; no engine/runner/dispatcher source changes."
}
],
"reviews": [
{
"reviewer": "/root/r04_review",
"scope": "All12 agent-owned hashes, shared contract, SQL23, final focused tests and root actual-browser/fixture delta",
"outcome": "Accepted without remaining source blockers. Independently ran API 12/177 and final retry/experiment UI 63/311; reviewed final backend PG 11/101 evidence. Root integrated all gates. R06 can enter review/uncommitted; full R05/R07 remain partial."
}
],
"limitations": [
"Manual retries apply only to failed canonical experiment trials with no result or cancellation. Same retained approved built-in, eligible single-asset data and exact installed build required for fresh acceptance. No standalone/batch retry endpoint.",
"History contains exact prior failures captured by accepted manual retries, not a reconstructed log of every automatic attempt. Original request/review snapshot remains unchanged; current approval is recorded separately on the receipt.",
"Lifetime attempt_number cannot decrease for experiment runs. Manual acceptance increments manual_retry_count only; the worker creates its fresh attempt UUID and increments attempt_number. Existing lifetime automatic-recovery budget is not reset.",
"Accepted receipt replay precedes current eligibility checks. Unresolved browser retry inputs/key persist through component refresh, not deliberate unload/navigation; saved receipts/history remain durable.",
"R05 provider preparation/default cutover and broader R07 comparisons remain incomplete. R08 readiness awaits R06 acceptance/commit; A01 additionally needs ADR-007. No performance/benchmark work, candidate execution, multi-asset/default/paper/live activation, AI execution, new-wave commit, push or PR.",
"Chromium only; existing bundle-size/Rust warnings and four manual Rust test exclusions remain. Initial focused SQL test parameter-type fixture error was corrected before the frozen 11/101 suite; final integrated gates passed on their first run."
],
"cleanup": "Both exact --rm disposable PostgreSQL/Redis fixture containers stopped successfully. 27 authored source/test files archived and hashed; isolated worktrees/logs retained. Development/production services and data untouched.",
"next": "Accept/commit this R06 retry completion, then start R08 bounded chronological parameter selection and reset-segment validation on the accepted retained-input experiment foundation. Pin explicit training/validation/test/warmup boundaries and selection rule before execution; preserve all candidate evidence and label reset-segment results honestly. Keep performance paused and R05/R07/AI/multi-asset/default activation gates intact."
}
}