Repository navigation
fix: keep every answer when a model task asks again - #191
Open
Bortlesboat wants to merge 1 commit into
Open
Bortlesboat wants to merge 1 commit into
Bortlesboat wants to merge 1 commit into
Conversation
Each model run starts with only the task prompt, so the reply to an earlier ask_user question has to come from saved state. Answering overwrote state.answer, so a task that asked two questions lost the first reply and the model never saw which question a reply answered. Keep the replies as a list with their questions and send all of them. Tasks saved with a single answer still read it.
This branch has not been deployed
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.
What changed
A delegated model task that asks the user more than one question forgets the earlier replies.
Each model run starts from a single user message built from the task prompt plus
state.answer.AgentService.answeroverwrotestate.answer, and the question itself is cleared when the task is requeued. So when a task asked "Which date should I use?" (answer "Friday") and then "What time works?" (answer "3pm"), the third run was sent only:"Friday" was gone from the request entirely, including
priorStatein the instructions, and the model had no way to know what "3pm" was answering.answernow appends{ question, answer }tostate.answers, and the model run sends every reply after the prompt asYou asked: ... / Answer: .... A task saved with the old singleanswerfield is still read, so tasks already waiting on input keep their reply.Verification
a model task keeps every earlier answer when it asks againtotests/model-outcome.test.ts. It drives twoask_userrounds and afinish_taskthrough the model fixture and checks that the third request contains both questions and both replies. It fails on main with the message shown above and passes with this change.pnpm lint,pnpm typecheck,pnpm --dir apps/worker typecheckandpnpm build:serverpass.pnpm test: 479 pass. On Windows,worker recovery preserves downloads when metadata cannot be inspectedfails on main too (symlink EPERM without Developer Mode), and the telemetry probe can hit its 15s timeout under the full suite (Tests: telemetry probes can exceed their 15s execFile timeout on Windows (cold tsx transpile + AV scanning) #176); it passes when run alone.