delegate_gemini: error clearly on checkpoint-miss-on-resume + guarantee an answer at the step cap - #19
Merged
Merged
Conversation
… with an undefined task; throw a clear, distinct error instead
…e: withhold function-calling tools entirely on the final allowed step instead of relying on a text reminder
… now has no tools available at all, not just a soft suggestion to wrap up
…d-error when there is truly nothing to fall back on (no task provided either); if a task WAS provided alongside a resume_run_id that fails to load, keep the graceful fresh-start fallback for defensive callers
…ition to the hard final-step guarantee), per the documented fix plan's escalating-notice design
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Fixes the regression found while live-testing the 2026-07-26
delegate_geminiresume fix (PR #17). Full writeup: madmcp-delegate-gemini-resume-checkpoint-miss-2026-07-26 / BUG page (Notion).1. Checkpoint-miss-on-resume no longer silent
runInvestigationcouldn't previously distinguish "no resume requested" from "resume requested butloadCheckpointreturned null" (expired TTL, Redis unavailable, bad id) -- both fell through to the same fresh-run branch, which on a resume call could build a prompt from a literalTask: undefined. Confirmed live: the model burned 5 steps hunting Mem0/Notion for context before stumbling onto its own prior partial-run log.Now:
resume_run_idgiven + no checkpoint loaded + notaskprovided -> throws a clear, distinct error ("has no live checkpoint ... no saved task to resume from"), caught bytools.js's existing try/catch and returned as an explicit failure. If ataskwas also provided, the existing graceful fresh-start fallback is preserved (defensive-caller pattern).2. Step-budget cap now guarantees an answer attempt
Previously only a text reminder asked the model to wrap up near the step cap -- in testing, the model used its literal last step on another tool call anyway, and the run hit the cap with zero synthesized answer. Fixed structurally: the final allowed step now calls Gemini with no function-calling tools in the request at all, so a function call is impossible on that turn by construction, not by instruction-following. Kept an escalating text nudge on top (2 steps remaining: wrap up; 1 remaining: this turn has no tools, answer now) for quality.
Testing status
Both fixes are unit-reasoned through the code paths but not yet re-verified end-to-end against live Gemini + Redis (the original bug was only caught via a live test). Recommend a live re-test before merge:
resume_run_idand notask-> should now return a clear error, not a confused run.max_steps-> should now return some answer (even if explicitly marked incomplete) at the cap, never a bare "(stopped after reaching cap)" with nothing.