Repository navigation
fix(plan): repeat Q&A and draft decisions inline in each plan prompt - #488
Master-Norna wants to merge 1 commit into
Conversation
…mputun#438) Plan mode is where the progress file carries control flow: the questions, the answers and the draft decision (with the revise feedback) reach the executor only through that file, and the prompt tells it to read them from there. The logger opens the file once and appends to it for the whole run, so an executor behind a shared filesystem can keep reading a snapshot taken before the append (umputun#438): the agent re-asks the same question on every iteration and never sees the draft decision. Opening and closing the file per write would need a sidecar lock, since the flock on that file is the active-session signal, so plan mode now carries the exchange with it as well. Each plan iteration prompt gets a SESSION HISTORY block with the questions, answers and draft reviews accumulated in this run, including the feedback of a revise. The block is empty on the first iteration, so the first prompt is byte-identical to before, and PREVIOUS DRAFT FEEDBACK is left as it was. The prompt template takes the block as an alternative source for the accept, revise and reject decisions. Co-Authored-By: Agent-Yan <352840372+Agent-Yan@users.noreply.github.com>
|
closing this one. Docker Sandboxes fixed the held-fd problem in sbx v0.45.0 (docker/sbx-releases#488, closed 2026-10-04), so the condition I set in #438 for taking the inline workaround never happened. The supported the implementation follows what I sketched in #438, and the sketch itself had a gap. After accept, the next session gets |
Summary
Plan mode is the one place where the progress file carries control flow: the questions, the answers and the
DRAFT REVIEW: …decision (with the revise feedback) reach the executor only through that file, and the prompt tells it to read them from there. The logger opens the file once and appends to it for the whole run (pkg/progress/progress.go), so an executor behind a shared filesystem can keep reading a snapshot taken before the append — the setup in #438 (executor in a Docker Sandbox, workspace on virtiofs) has the agent re-ask the same question on every iteration and never see the draft decision.As you noted in #438, open/close per write would need a sidecar lock because the flock on that file is the active-session signal, so plan mode now carries the exchange with it as well.
Fix
planSessioninpkg/processor/phase/plan_creation.gokeeps what the run already knows: each question with its answer, each draft review with its feedback.runIterationappends aSESSION HISTORYblock to the plan prompt when the session has entries. The block is empty on the first iteration, so the first prompt stays byte-identical to master, andPREVIOUS DRAFT FEEDBACKis untouched.The block uses the same lines the progress file records (
QUESTION:,ANSWER:,DRAFT REVIEW:,FEEDBACK:), so the template can treat it as an alternative source: the accept / revise / reject decision points inpkg/config/defaults/prompts/make_plan.txtnow read "the progress file or the SESSION HISTORY block", and the Q&A instruction says the exchange is repeated inline from the second iteration on.CLAUDE.mdgets the matching line under plan mode.Validation
pkg/processor/phase/plan_creation_test.go, all four red on master (03ad9da) and green with the change: Q&A reaches the next prompt, an accepted draft is visible in the next prompt, a revise's feedback is visible in the next prompt, and a three-iteration run keeps one copy of each entry with the question before its answer.FEEDBACK:assertion is not trivially satisfied: dropping the feedback branch fromaddDraftDecisionleaves the block in place and still turns that test red.go test ./pkg/processor/... ./pkg/config/: theprocessorpackages pass;pkg/configfails the same two permission-denied tests it fails on master.go test ./...: the failure set matches master exactly — the same 22 environment-specific tests (Windows permission and symlink cases, codex CLI lookups, worktree tests).golangci-lint run ./...(v2.13.0, repo config): 0 issues.gofmt,go vet: clean.Agent Yan assisted participation