Repository navigation
Conversation
…rerun, clarifying questions Work in progress; review fixes and the end-to-end test results follow. - Runs freeze the segment (distribution_runs.input) and work from it. - Stop: a "stopped" status nothing overwrites, Inngest cancelOn, inline runs watch their row; timeouts per company's research and per run. - Per-run results (distribution_run_results), listed in the run sheet. - Rerun from a run's input, reusing its plan and research under 7 days. - Optional clarifying questions before a live run. - Fixes from review: similar.ts fallback, pageImages fallthrough and local-host refusal, match points only on a yes, icons kept, picture step bounded, stale runs ended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From three independent reviews (smells, latency, reliability): - Research reuse is keyed to the segment's own research time and input (relationships.researched_at / researched_for), set only when research actually ran: reuse no longer renews itself, and an edited segment or different answers research again. - Research that fails or times out keeps the previous dossier; every page it reads is cut off at the deadline too. - Each company bumps the run row (touchRun), so a long run is never ended as stale; finished statuses (not only stopped) are never overwritten. - Every step checks for a stop (a lost cancel no longer keeps spending); a stop mid-research skips that company and keeps the run's summary. - Exclusions come from the frozen input; reruns pick a mode the environment can serve, and a pre-snapshot run plans again. - Finished runs skip the progress query and stop polling; stale-run cleanup at most once a minute; clarifying questions cached per segment version; indexes for run-result cascades; Inngest finish 90m. - Shared run-start rules (rerunOf, runModeFor, insufficientCreditsResponse), RunProgram type, one clarification limit, publicHttpsUrl (refuses trailing-dot local names), doc and import tidy-ups. - Two SQL bugs the end-to-end test caught: Dates passed raw into the status guard and the stale check. Tests: run-lifecycle.e2e (frozen input, per-run results, rerun without planning or research, fresh research, stop between steps and mid-research, stale queued and silent runs) and clarify-before-run (UI flow). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- failRun can no longer write an error onto a finished (stopped) run: errorMessage joins the finished-status guard. - A run finished before it starts, or stopped while it searches, exits prepare early: no resolve, research, pictures or empty summary; the Inngest picture step skips a stopped run (a cancel that never arrived). - Any research that does not finish (thrown, timed out, out of turns) keeps the earlier dossier, and an earlier dossier is not republished. - Research reuse is also keyed to HS codes; answers are normalised. - Bounded stale-check memory; per-instance caches documented. - Tests: stopped before pickup, no error on a stopped run, earlier research kept on failure without restarting the reuse clock, and the run row bumped while a company is researched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This makes Prospects runs durable, faster to repeat, and reliable to stop.
distribution_runs.inputholds the segment as it was, plus any answers given before the run.programForRun, including exclusions. Editing a segment mid-run changes nothing, and a run can be repeated exactly.stoppedstatus.cancelOnon the job.distribution_run_resultspoints at the segment's company rows, which stay as the shared pipeline (stage, notes, people).partner_relationships.researched_at/researched_for, so it never renews itself or crosses segments.freshResearch/replanare available.timeouts {start: 15m, finish: 90m}andretries: 2.failStaleRunsends runs that are stuck queued or have gone silent, with the reason.find_similar_companiesfallback took the wrong batch.pageImagesgave up after an unusable tag.publicHttpsUrl).Efficiency
Testing
run-lifecycle.e2e(8 tests, real Postgres, sample providers):clarify-before-run(4 tests): the real provider and dialog. No questions starts at once; answers are passed; Skip; a failed ask never blocks.tsc, pipelines and toolstsc, and eslint on the changed files: clean.Notes for reviewers
prospects_run_lifecycle, additive only:distribution_runs.input;partner_relationships.researched_atandresearched_for;distribution_run_resultstable with 4 indexes.schema.ts.invokeStructuredtakes no signal). The cache keeps that to at most once per segment version.run.test.tsis updated to match.🤖 Generated with Claude Code