Repository navigation
Keep only live taskman work in memory and drop unused startup load - #253
Merged
Merged
Conversation
Startup restored every taskman job of the last day, including finished dialog jobs that still carried their agent checkpoint, then ran the interest rollup and a full memory scan while catching up. - Load active jobs plus a short finished tail at startup; evict finished jobs from memory without journal deletes and purge them in Postgres by finish time. Finished-job listings read taskman_jobs. - Drop the agent_checkpoint event when a job finishes. - Remove the unused chat_history/interest rollup (migration 201). - Delay the first analytics archive pass; scan recent memory hours at startup. - Retry outbox enqueue on Postgres pool timeouts. - Wait up to 10 minutes for health and readiness on deploy.
Owner
Author
|
Danger warnings: the deployment-risk note and post-deploy verification plan are now in the PR description. The size stays in one PR because the startup load, eviction, Postgres listing and purge change the same task-queue contract and must ship together; the remaining parts (interest rollup removal, archive delay, outbox retry, deploy wait) are small and target the same startup slowdown. |
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
Startup took several minutes because the process restored every taskman job of the last day, including finished dialog jobs that still carried their full agent checkpoint, and then ran heavy analytics and memory scans while it caught up on the update backlog. This change keeps only live work in memory and removes the unused write load.
Task queue: memory holds live work, Postgres holds history
taskmanJobsand the admin job list readtaskman_jobsfor any filter that can include finished jobs (filters, counts, sorting and paging run in SQL; rows come without their event log). Pending/processing-only filters still read memory.Dialog checkpoint is dropped when a job finishes
The
agent_checkpointevent exists so a running turn can resume after a crash. Completing, failing or cancelling a job now removes it, so finished rows no longer carry the turn input and agent state.Remove the chat interest rollup
chat_history/interestrollups were rebuilt from every memory episode on each analytics pass and nothing reads them. The rollup is removed, and migration 201 rebuildstelemetry_rollupswithout those rows (one-way; the down migration is a no-op).Less work during startup catch-up
Delivery and deploy
Compatibility
RuntimeTaskmanInspector::list_jobsis now async.Deployment risk and verification plan
telemetry_rollupsinside one transaction at startup; it runs while the previous container is stopped, and only the removed rollup wrote to those rows./api/healthand/api/ready; check that migration 201 applied andtelemetry_rollupsholds nochat_history/interestrows; compare process memory with the previous release; open the admin job list with a finished-status filter; watch dialog terminal failures and outbox enqueue warnings for 30 minutes.Verification
cargo fmt --all,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace.cargo test -p openplotva-storage live_(33 passed), including new tests for startup loading, SQL listing/search/delete, purge by finish time and the outbox pool-timeout retry.