Skip to content

Add plan-mode pending guard to enforce enter_plan_mode after reading plan_sop#459

Open
HamsteRider-m wants to merge 1 commit into
lsdefine:mainfrom
HamsteRider-m:fix/plan-mode-guard-458
Open

Add plan-mode pending guard to enforce enter_plan_mode after reading plan_sop#459
HamsteRider-m wants to merge 1 commit into
lsdefine:mainfrom
HamsteRider-m:fix/plan-mode-guard-458

Conversation

@HamsteRider-m
Copy link
Copy Markdown

@HamsteRider-m HamsteRider-m commented May 22, 2026

What

When plan_sop.md is read, a pending plan-mode flag is now set. If the agent does not call handler.enter_plan_mode(...) in the same turn, the turn-end callback injects a hard guard that blocks normal execution until plan mode is properly entered. Once enter_plan_mode() succeeds, the pending state is cleared and all existing in-plan-mode checks take over.

This prevents the agent from reading the SOP, extracting its points, and then continuing ordinary execution without ever creating a plan file or entering plan mode.

Changes

  • ga.py: set plan_mode_pending on plan SOP read; inject guard in turn_end_callback() when pending but not yet in plan mode; clear pending on enter_plan_mode().
  • test_plan_mode_guard.py: three test cases covering pending flag set, guard interception, and pending cleared on entry.

Verification

python -m pytest -q test_plan_mode_guard.py   # 3 passed
python -m py_compile ga.py test_plan_mode_guard.py   # ok

Closes #458

@HamsteRider-m HamsteRider-m changed the title Fix plan SOP pending mode guard Add plan-mode pending guard to enforce enter_plan_mode after reading plan_sop May 22, 2026
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.

Plan mode can be bypassed after reading plan_sop without enter_plan_mode

1 participant