Repository navigation
feat(agents): save after each tool call, cap the reading, keep the first save's nudges - #41
Open
spacedevin wants to merge 2 commits into
Open
spacedevin wants to merge 2 commits into
spacedevin wants to merge 2 commits into
Conversation
…quireAction A run cut off mid-round lost every finished call of that round: on resume they were answered as interrupted, and the model ran them again, so an edit could land twice. Each finished call is now checkpointed at once in `toolResults`, keyed by call id, and a resume answers it from there instead of running the tool again. `requireAction.maxReadRounds` (with `readMessage`) tells a model that has only read for that many rounds to act, and requires a tool call on its next model call. The count and the forced call are checkpointed (`readRounds`, `mustCallTool`) and carry over a resume.
The first record was saved with `nudgesLeft: 0`, so a turn resumed before its first round ended got no nudges. It now saves the count `requireAction` starts with.
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.
runAgentLoop(and sorunPersistent) checkpoints after every finished call, not only at a round's end.LoopCheckpoint.toolResultsholds the round's finished calls by call id ({ id, name, argsText, ok, summary, content });resumeRunanswers those from the checkpoint, so a tool is never run twice. Calls that never finished are still answered as interrupted.requireAction: { maxReadRounds, readMessage }: after that many rounds of only read-only calls with nothing acted, the model getsreadMessage(defaultDEFAULT_READ_NUDGE, also sent toonNudge) and its next model call hastoolChoice: "required". Checkpointed asreadRoundsandmustCallTool, carried over a resume (ResumeStategainstoolResults,readRounds,mustCallTool).runPersistent's first record savednudgesLeft: 0; it now saves the real starting count (initialNudges(requireAction)).Tests: Tish smoke (VM and JS agree) and
src/agents/__tests__/agents-tool-saves.test.ts.