Skip to content

fix: end an agent's turn only after a committed action - #16

Merged
MasonN808 merged 1 commit into
mainfrom
fix/turn-commit-on-state-change-main
Oct 23, 2026
Merged

MasonN808 merged 1 commit into
mainfrom
fix/turn-commit-on-state-change-main

Conversation

@MasonN808

Copy link
Copy Markdown
Collaborator

Summary

Ports the v0.2.1 fix (9aa897e, tag v0.2.1) to main: an agent's turn ends only after a committed action, not after any successful environment tool call.

Since v0.2.0, BaseAgent set _env_state_committed for every environment tool result without an error. That was a side effect of removing state_updates (the old commit signal) in edef37b, and it made read-only tools such as Hospital get_job_queue and find_available_slots end the turn before the agent could act on what it saw.

Changes

  • BaseAgent commits a turn only when a result carries "action_committed": True, and strips the key before the result reaches the model. Legacy state_updates results still commit.
  • Every shipped DCOP tool sets the flag on its success path, after blackboard logging, so logged results are unchanged.
  • Main-only: IsThisSeatTakenTools has only action tools, so it flags every successful result and its turns end exactly as before.
  • docs/components/tools.md documents the flag; CHANGELOG gets a v0.2.1 entry under [Unreleased].

Testing

  • New terrarium/tests/test_base_agent_turn_commit.py: 5 of its v0.2.1 tests fail on unpatched v0.2.0, as intended; 2 more cover the seat environment on main.
  • Full suite on this branch: 106 passed, 3 skipped.
  • Colosseum hospital runs with 3 conversation steps: turns ending right after a read-only call went from 5/18 on v0.2.0 to 0 on v0.2.1, matching v0.1.1 (0).

🤖 Generated with Claude Code

https://claude.ai/code/session_019aZZj794GDrpH36PWqn1ZM

Port of the v0.2.1 fix (9aa897e) to main.

Since v0.2.0, BaseAgent ended a turn after any successful environment tool
call, so read-only tools (e.g. Hospital get_job_queue, find_available_slots)
cut the turn short before the agent could act on what it saw. Tools now
report a committed action with "action_committed": True; BaseAgent strips the
key before the result reaches the model and still honors legacy state_updates.

Main-only: IsThisSeatTakenTools has only action tools, so it flags every
successful result. Its turns end exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019aZZj794GDrpH36PWqn1ZM
@MasonN808
MasonN808 merged commit 06bcdd9 into main Oct 23, 2026
1 check passed
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