Repository navigation
fix(server): reuse stored research when jobs resume - #213
Conversation
i098
left a comment
There was a problem hiding this comment.
Reviewed stored-research recovery, planner retries, authorization, recipient protection, and paid-call accounting. The review found no defects.
The regression fails before the fix and passes after it. All 10 research tests passed against the shared MySQL server. Pipeline worker checks also covered HTTP 429, HTTP 503, empty resumed plans, recipient changes, and fresh non-research jobs.
The pipeline clarified the recovery and cost documentation. Documentation checks, typechecks, Fallow, Sentrux, and the latest CI checks passed.
The pipeline Test step used a disposable local MySQL instance instead of the shared server; this exception is recorded in the PR body. Providers were synthetic; no real email or paid request occurred.
Validated head: a84e98e.
Validation environment
The worker ran the research suite against the authorized shared MySQL server: 10 tests passed.
The no-mistakes Test step instead used a disposable local MySQL instance with synthetic providers.
Firstmate accepted that Test result; the instance was removed after validation.
No real email or paid provider request occurred.
Closes #106
Intent
Implement Sanctum (the open-source ambient AI meeting listener and shared agent memory) end to end from tasks/plan.md through tasks/todo.md, delivered through PRs to main, in TypeScript + Effect as the repo specifies, passing every existing gate (npm run check, docs render/build, Fallow, Sentrux, Conventional Commits, CI) without weakening thresholds, exclusions, or baselines. Standing order: "If you finish early give yourself new goals bruh". Current goal: fix open GitHub issue #106 "research.run resume ignores research it already stored" in i098/sanctum.
Issue section: Problem
A resumed
research.runjob can ignore research it already paid for and stored.The job then succeeds with
research: null, althoughpaid_model_callsandcontext_itemsshow paid research for this job. Any email is planned without the cited research.Found by the no-mistakes review of the
research.runexecution change (closes #95). This rarer retry path is a follow-up, like #104.Issue section: Reproduction
web_research: truewith a Gmail email whose body waits for the research.webResearchmakes the paid call and stores theresearchartifact and theresearch_observationcontext item.retry-after), so the job pauses before it requests any action. A retryableUnavailablehas the same effect.research_job_id, soearlierAttemptreturns null and the first planner pass runs again.web_research: false, or propose the email with a body it wrote itself.Issue section: Expected behavior
storedResearchorstoredArtifact).web_researchvalue is, use the stored research, and run the research pass over the planned actions. This adds no new state.web_research: false; the result still reports the stored research and plans the email from it.Issue section: Environment and checks
Found during code review on main; no runtime environment.
What Changed
research.runplan declines web research, and plan actions from the stored result.Risk Assessment
✅ Low: The change reuses stored research through existing planning and authorization paths, adds no persistent state, and includes a behavioral regression test.
Testing
Focused tests and five real-worker scenarios passed, with persisted evidence. The base executor reproduced the defect. Planner, OpenAI, and Pipedream responses came from local HTTP fixtures; no real paid call or email occurred. Disposable MySQL had fsync disabled.
Evidence: Original defect reproduction
~/.no-mistakes/evidence/01M5E17F3M11A91HFZ1178R2AZ/target-1-result.json)~/.no-mistakes/evidence/01M5E17F3M11A91HFZ1178R2AZ/target-2-result.json)~/.no-mistakes/evidence/01M5E17F3M11A91HFZ1178R2AZ/target-3-result.json)~/.no-mistakes/evidence/01M5E17F3M11A91HFZ1178R2AZ/target-4-result.json)Evidence: Fresh non-research job
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
SANCTUM_TEST_MYSQL_URL=mysql://root@127.0.0.1:23316 npm exec --workspace @sanctum/server -- vitest run tests/research.test.tspassed after resolving disposable database stalls.node .test-runtime/research-live.tspassed five scenarios using the real worker and isolated MySQL.node .test-runtime/research-live.ts --baselinereproduced the original defect using the base executor.Initial database and API startup attempts timed out. Worker-only validation subsequently completed.Stopped test processes and removed disposable resources.git status --porcelainreturned no output.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.