Skip to content

fix(agent): reserve final step for response - #269

Open
mikemikimike wants to merge 2 commits into
AtomicBot-ai:mainfrom
mikemikimike:codex/issue-256-persistent-search-state
Open

fix(agent): reserve final step for response#269
mikemikimike wants to merge 2 commits into
AtomicBot-ai:mainfrom
mikemikimike:codex/issue-256-persistent-search-state

Conversation

@mikemikimike

@mikemikimike mikemikimike commented Aug 28, 2026

Copy link
Copy Markdown

Summary

When an agent used every configured step for non-terminal tools, the loop emitted a synthetic max-steps reply without giving the model a chance to summarize completed work. This change reserves the final budgeted inference for reply or finish.

Changes

  • Limit the final step's prompt and native tool payload to the terminal tools.
  • Reject non-terminal calls during final-step parsing before any tool execution.
  • Preserve the existing stalled/max-steps result if finalization cannot produce a terminal response.
  • Add an AgentLoop regression test covering a tool step followed by a final reply.

Validation

  • npm test -- --run src/agent/agent-loop.test.ts src/agent/step-executor.test.ts (64 passed)
  • npm run lint (passed)
  • git diff --check (passed)

The full test run reached 6,290 passing tests; 17 unrelated tests failed due to existing Windows/environment issues, including POSIX-only executable/path assumptions, temporary-directory teardown locks, a missing eval fixture, and platform-sensitive timing tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant