fix(insights): bound business context generation and stop stale work - #765
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR bounds organization business-context generation by both queue age and worker runtime, adds lifecycle checkpoints to stop stale work, reserves time for billing and persistence, and aggregates both model phases through one AI logger.
Confidence Score: 5/5The PR appears safe to merge; guarded persistence and lifecycle checkpoints prevent stale generation work from overwriting newer state. No actionable failures remain after verifying that terminal writes recheck generation identity and status atomically, while model work, billing, and persistence observe their intended deadline boundaries. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Queued generation] --> B[Load and validate current state]
B --> C{Deadline and generation current?}
C -- No --> X[Stop or persist friendly failure]
C -- Yes --> D[Load website and verify credits]
D --> E[Read homepage and discover paths]
E --> F[Selection model call]
F --> G[Bill consumed selection call]
G --> H{Generation still current?}
H -- No --> Y[Stop stale work]
H -- Yes --> I[Read selected pages]
I --> J{Generation still current?}
J -- No --> Y
J -- Yes --> K[Synthesis model call]
K --> L[Bill consumed synthesis call]
L --> M[Guarded ready-state persistence]
C -. work deadline .-> N[Five-second settlement reserve]
N --> G
N --> L
N --> M
Reviews (1): Last reviewed commit: "fix(insights): bound business context ge..." | Re-trigger Greptile |
Description
Saving or cancelling during selection now stops further page reads and synthesis while billing the consumed call. Both model phases share one AI logger so the generation summary includes their combined usage.
Queue age counts toward the existing 180-second request deadline. Work is capped at 115 seconds with a five-second reserve for returned-call billing and persistence; model timeouts use the remaining budget.
Slice
apps/insights/src/organization-business-context.tsand its worker tests.nullthrough the existing services contract.Validation
AI-assisted, maintainer-directed implementation.
Summary by cubic
Fixes business context generation to respect the 180‑second request deadline and stop work when the generation is saved, cancelled, or superseded, while still billing consumed model calls.
Behavior changes
Written for commit 76dfb18. Summary will update on new commits.