• wwwillchen-bot's avatar
    feat: ensure local agent completes todos before ending turn (#2601) · 54444ddf
    wwwillchen-bot 提交于
    ## Summary
    - When a local agent ends its turn with incomplete todos (pending or
    in_progress), a reminder message is now injected telling it to continue
    and complete the remaining tasks
    - This only happens once per turn to avoid infinite loops
    - Added `hasIncompleteTodos()` and `buildTodoReminderMessage()` helpers
    to prepare_step_utils.ts
    - Added `TodoReminderState` to track whether a reminder has already been
    sent this turn
    
    Fixes #2600
    
    ## Test plan
    - Unit tests added for:
      - `hasIncompleteTodos()` - correctly detects pending/in_progress todos
    - `buildTodoReminderMessage()` - builds proper reminder message listing
    incomplete todos
      - `prepareStepMessages()` with todoContext:
        - Injects reminder when agent finishes with incomplete todos
        - Does not inject reminder when already reminded this turn
        - Does not inject reminder when all todos are completed
        - Does not inject reminder when agent has pending tool calls
        - Combines reminder with existing injected messages
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2601"
    target="_blank">
      <picture>
    <source media="(prefers-color-scheme: dark)"
    srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
    <img
    src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
    alt="Open with Devin">
      </picture>
    </a>
    <!-- devin-review-badge-end -->
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Ensures the local agent completes remaining todos before ending a turn
    by running a one-time outer-loop follow-up pass that adds a reminder.
    The reminder is not persisted. Meets #2600.
    
    - **New Features**
    - Outer-loop detection via shouldRunTodoFollowUpPass: runs one follow-up
    pass when the final step has no tool calls and incomplete todos remain;
    skips in read-only and plan modes.
    - Helpers hasIncompleteTodos() and buildTodoReminderMessage();
    multi-pass E2E fixture and test; fake LLM server scans all user messages
    and counts todo reminders to drive passes.
    
    - **Refactors**
    - Removed inner-loop reminder injection from prepareStepMessages; tests
    cleaned up.
    - Restructured local_agent_handler into a controlled pass loop with
    createdAt guards, baseMessageHistoryCount and compaction state reset
    each pass, AI messages persisted across passes, and synthetic todo
    reminders excluded from aiMessagesJson; updated compaction test to
    include toolCalls in mock steps.
    
    <sup>Written for commit 70b9c5a6595c5b024d25665e785d93dd77a3076f.
    Summary will update on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    
    ---------
    Co-authored-by: 's avatarWill Chen <willchen90@gmail.com>
    Co-authored-by: 's avatarClaude Opus 4.5 <noreply@anthropic.com>
    54444ddf
名称
最后提交
最后更新
.claude 正在载入提交数据...
.cursor/rules 正在载入提交数据...
.devcontainer 正在载入提交数据...
.github 正在载入提交数据...
.husky 正在载入提交数据...
.storybook 正在载入提交数据...
assets 正在载入提交数据...
docs 正在载入提交数据...
drizzle 正在载入提交数据...
e2e-tests 正在载入提交数据...
makers 正在载入提交数据...
packages/@dyad-sh 正在载入提交数据...
rules 正在载入提交数据...
scaffold 正在载入提交数据...
scripts 正在载入提交数据...
shared 正在载入提交数据...
src 正在载入提交数据...
testing 正在载入提交数据...
tools 正在载入提交数据...
worker 正在载入提交数据...
workers/tsc 正在载入提交数据...
.cursorignore 正在载入提交数据...
.env.example 正在载入提交数据...
.eslintrc.json 正在载入提交数据...
.gitattributes 正在载入提交数据...
.gitignore 正在载入提交数据...
.npmrc 正在载入提交数据...
.oxfmtrc.json 正在载入提交数据...
.oxlintrc.json 正在载入提交数据...
.prettierignore 正在载入提交数据...
.prettierrc 正在载入提交数据...
AGENTS.md 正在载入提交数据...
CLA.md 正在载入提交数据...
CLAUDE.md 正在载入提交数据...
CONTRIBUTING.md 正在载入提交数据...
LICENSE 正在载入提交数据...
README.md 正在载入提交数据...
SECURITY.md 正在载入提交数据...
biome.json 正在载入提交数据...
components.json 正在载入提交数据...
drizzle.config.ts 正在载入提交数据...
forge.config.ts 正在载入提交数据...
forge.env.d.ts 正在载入提交数据...
index.html 正在载入提交数据...
lint-staged.config.js 正在载入提交数据...
merge.config.ts 正在载入提交数据...
package-lock.json 正在载入提交数据...
package.json 正在载入提交数据...
playwright.config.ts 正在载入提交数据...
tsconfig.app.json 正在载入提交数据...
tsconfig.json 正在载入提交数据...
tsconfig.node.json 正在载入提交数据...
vite.main.config.mts 正在载入提交数据...
vite.preload.config.mts 正在载入提交数据...
vite.renderer.config.mts 正在载入提交数据...
vite.worker.config.mts 正在载入提交数据...
vitest.config.ts 正在载入提交数据...
windowsSign.ts 正在载入提交数据...