Uh oh!
There was an error while loading. Please reload this page.
Add plan_resume MCP tool for mid-pipeline recovery - #217
Merged
Conversation
… progress Unlike plan_retry which clears all artifacts and restarts from scratch, plan_resume preserves completed pipeline outputs and restores the run directory from the stored zip snapshot. Luigi then skips completed tasks and picks up where the pipeline left off. This is the #1 blocker for autonomous agent workflows (Proposal 87) and a prerequisite for the autonomous prompt optimization loop (Proposals 94/59), which needs fast re-runs that skip completed tasks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ing options Resuming a plan after pipeline changes (renamed filenames, new tasks, changed schemas) can produce errors or inconsistent output. Added guidance on when resume is safe vs when plan_retry is preferred, plus a comparison of future mitigation approaches (version integer, content hash, manifest JSON). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ive re-run The MCP tool restricts resume to failed plans, but the underlying Luigi mechanism is more general — deleting output files triggers re-execution of those tasks and their downstream dependents. Documented that this capability is available locally via run_plan_pipeline.py. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…shots Store a PIPELINE_VERSION integer constant (initially 1) that gets stamped into plan parameters on create, retry, and resume. On resume, reject with PIPELINE_VERSION_MISMATCH if the stored version differs from the current version, directing callers to use plan_retry instead. Legacy plans with no stored version are treated as incompatible. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* main: fix: correct PLANEXE_OUTPUTS_DIR docs - accurate incident description fix: address PR #230 review - add docs, remove gitignore change fix: decouple planexe-outputs from git repo docs: explain why ThinkingAwareOpenAILike exists vs LMStudio class docs: Add thinking tokens section to LM Studio provider guide Add ThinkingAwareOpenAILike class for LM Studio thinking token handling docs(proposal-103): extend with llama_index silent truncation findings from local model runs
Add PLANEXE_METADATA (001-3-planexe_metadata.json) to FilenameEnum and write it in ExecutePipeline.run() before luigi.build() starts. This persists the pipeline version in the zip snapshot for future inspection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
After restoring the zip snapshot in the worker, read pipeline_version from 001-3-planexe_metadata.json and reject the resume if it differs from the current PIPELINE_VERSION. Sets the plan back to failed so the caller can use plan_retry instead. Handles missing/corrupt metadata files by defaulting to None (incompatible). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…plan_resume descriptions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…acing text Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nstructions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…facing descriptions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… server instructions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…date log messages Replace 'task' with 'plan', 'run directory' with 'output directory' in the resume block of worker_plan_database/app.py. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document the in-progress migration from task_id to plan_id and from run to plan for new code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ip_snapshot Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…line_version.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Catalogs 9 test scenarios covering plan_resume, pipeline version mismatch, retry vs resume, and full happy path. Split into no-LLM (deterministic, cheap) and LLM-required (slow, costly) groups. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Handle both old (llama_index.core.llms.types) and new (llama_index.core.base.llms.types) module locations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove nested app.app_context() blocks from _handle_task_completion — the callback already runs inside the outer context opened by execute_pipeline_for_job(). Nested contexts cause Flask-SQLAlchemy to tear down the scoped session on exit, corrupting the connection and triggering psycopg2 DatabaseError / ResourceClosedError in subsequent db operations like token metrics recording. Also add missing column migrations (thinking_tokens, duration_seconds, success, error_message, raw_usage_data) to ensure_token_metrics_columns so tables created by older model versions get the columns the ORM now expects. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
neoneye added a commit
that referenced
this pull request
Mar 10, 2026
The plan_resume MCP tool (PR #217) supports resuming failed plans without discarding completed intermediary files. This adds a Resume button next to Retry in the multi-user frontend so users can access this functionality from the UI. - Add /plan/resume POST endpoint with pipeline version check - Use formaction to share a single form with model_profile dropdown - Resume is enabled only in failed state; Retry also works in stop_requested - Tooltips explain the difference between the two actions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7 tasks
neoneye added a commit
that referenced
this pull request
Mar 10, 2026
The plan_resume MCP tool (PR #217) supports resuming failed plans without discarding completed intermediary files. This adds a Resume button next to Retry in the multi-user frontend so users can access this functionality from the UI. Frontend endpoint (/plan/resume): - Validates owner/admin auth, rejects non-failed state - Checks pipeline_version compatibility; redirects with error banner on mismatch instead of showing raw JSON - Preserves all artifacts (key difference from retry) - Sets resume=True, increments resume_count, archives billing entries - Adds EventItem audit trail Template (plan_iframe.html): - Shared form with formaction for Retry and Resume buttons - Resume only enabled in failed state (not stop_requested) - Tooltips explain the difference between the two actions - Inline error banner when resume is rejected due to version mismatch Worker fix (worker_plan_database/app.py): - Truncate progress_message to fit varchar(128) column, fixing a StringDataRightTruncation crash on pipeline version mismatch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
neoneye added a commit
that referenced
this pull request
Mar 10, 2026
The plan_resume MCP tool (PR #217) supports resuming failed plans without discarding completed intermediary files. This adds a Resume button next to Retry in the multi-user frontend so users can access this functionality from the UI. Frontend endpoint (/plan/resume): - Validates owner/admin auth, rejects non-failed state - Checks pipeline_version compatibility; redirects with error banner on mismatch instead of showing raw JSON - Preserves all artifacts (key difference from retry) - Sets resume=True, increments resume_count, archives billing entries - Does NOT stamp pipeline_version — leaves that to the worker after successful artifact validation - Adds EventItem audit trail Template (plan_iframe.html): - Shared form with formaction for Retry and Resume buttons - Resume only enabled in failed state (not stop_requested) - Tooltips explain the difference between the two actions - Inline error banner when resume is rejected due to version mismatch Worker fix (worker_plan_database/app.py): - Truncate progress_message to fit varchar(128) column, fixing a StringDataRightTruncation crash on pipeline version mismatch - Clear pipeline_version from parameters on mismatch rejection so subsequent frontend resume attempts are correctly blocked Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
neoneye added a commit
that referenced
this pull request
Mar 10, 2026
The plan_resume MCP tool (PR #217) supports resuming failed plans without discarding completed intermediary files. This adds a Resume button next to Retry in the multi-user frontend so users can access this functionality from the UI. Frontend endpoint (/plan/resume): - Validates owner/admin auth, rejects non-failed state - Checks pipeline_version compatibility; redirects with error banner on mismatch instead of showing raw JSON - Preserves all artifacts (key difference from retry) - Sets resume=True, increments resume_count, archives billing entries - Does NOT stamp pipeline_version — leaves that to the worker after successful artifact validation - Adds EventItem audit trail Template (plan_iframe.html): - Shared form with formaction for Retry and Resume buttons - Resume only enabled in failed state (not stop_requested) - Tooltips explain the difference between the two actions - Inline error banner when resume is rejected due to version mismatch Worker fix (worker_plan_database/app.py): - Truncate progress_message to fit varchar(128) column, fixing a StringDataRightTruncation crash on pipeline version mismatch - Clear pipeline_version from parameters on mismatch rejection so subsequent frontend resume attempts are correctly blocked Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
neoneye added a commit
that referenced
this pull request
Mar 10, 2026
The plan_resume MCP tool (PR #217) supports resuming failed plans without discarding completed intermediary files. This adds a Resume button next to Retry in the multi-user frontend so users can access this functionality from the UI. Frontend endpoint (/plan/resume): - Validates owner/admin auth, rejects non-failed state - Checks pipeline_version compatibility; redirects with error banner on mismatch instead of showing raw JSON - Preserves all artifacts (key difference from retry) - Sets resume=True, increments resume_count, archives billing entries - Does NOT stamp pipeline_version — leaves that to the worker after successful artifact validation - Adds EventItem audit trail Template (plan_iframe.html): - Shared form with formaction for Retry and Resume buttons - Resume only enabled in failed state (not stop_requested) - Tooltips explain the difference between the two actions - Inline error banner when resume is rejected due to version mismatch Worker fix (worker_plan_database/app.py): - Truncate progress_message to fit varchar(128) column, fixing a StringDataRightTruncation crash on pipeline version mismatch - Clear pipeline_version from parameters on mismatch rejection so subsequent frontend resume attempts are correctly blocked Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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 freeto 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
plan_resumeMCP tool that resumes a failed plan without discarding completed intermediary files — plan generation restarts from the first incomplete step, skipping all steps that already produced output filesPIPELINE_VERSIONinteger constant stamped into plan parameters on create, retry, and resume — on resume, the MCP layer rejects withPIPELINE_VERSION_MISMATCHif the stored version differs from the current version001-3-planexe_metadata.json(containingpipeline_version) to the output dir at start, persisting it in the zip snapshotpipeline_versionfrom the metadata file before proceeding — sets plan back to failed with a descriptiveprogress_messageon mismatchworker_plan_database/app.pyheader: new code should useplan_id(nottask_id) andplan(notrun)restore_run_dir_from_zip_snapshottorestore_output_dir_from_zip_snapshotdocs/proposals/112-end-to-end-test-plan.md) with 9 scenarios covering plan_resume, pipeline version mismatch, and full happy path — split into no-LLM and LLM-required groupscore.llms.types→core.base.llms.typesfallback)app.app_context()from_handle_task_completion— nested contexts tear down the scoped session, corrupting the connection for subsequent db operations like token metrics recordingthinking_tokens,duration_seconds,success,error_message,raw_usage_data) toensure_token_metrics_columnsso tables created by older model versions get the columns the ORM expectsTest plan
pytest mcp_cloud/tests/test_plan_resume_tool.py— covers structured content, SSE URL, PLAN_NOT_FOUND, PLAN_NOT_RESUMABLE, PIPELINE_VERSION_MISMATCH, and default model_profile (requires Docker/CI)pytest mcp_cloud/tests/test_tool_surface_consistency.py— verifies plan_resume is listed in tool definitionspytest mcp_local/— proxy testspytest worker_plan/worker_plan_api/tests/— unit tests for shared utilities (passes locally)001-3-planexe_metadata.jsonappears in the output zip🤖 Generated with Claude Code