Skip to content

fix(reflection): detect Plan mode in user-role system-reminder tags#113

Open
dzianisv wants to merge 1 commit intomainfrom
issue-74-plan-mode-reflection
Open

fix(reflection): detect Plan mode in user-role system-reminder tags#113
dzianisv wants to merge 1 commit intomainfrom
issue-74-plan-mode-reflection

Conversation

@dzianisv
Copy link
Owner

Summary

  • Fixes reflection in a Plan mode #74: Reflection was running in Plan mode because isPlanMode() never detected it
  • OpenCode injects Plan mode as <system-reminder> blocks inside user-role message parts, not system/developer messages
  • Rewrote isPlanMode() with 3 detection strategies covering all injection patterns
  • Added 25+ unit tests for all detection paths

Changes

  • reflection-3.ts: Rewrote isPlanMode(), exported it
  • reflection-3.test-helpers.ts: Added test-safe duplicate of isPlanMode()
  • test/reflection-3.unit.test.ts: Added comprehensive isPlanMode test suite

Testing

  • All 139 reflection tests pass
  • All eval suites pass (judge: 31, stuck: 18, compression: 17)

)

OpenCode injects Plan mode as <system-reminder> blocks inside user-role
message parts, not system/developer messages. The old isPlanMode() only
checked system messages and the last text part of the last user message,
so it never detected Plan mode in practice.

Rewrote isPlanMode() with three detection strategies:
1. Scan ALL messages' text parts for <system-reminder> containing
   'plan mode' or 'READ-ONLY phase'
2. Check system/developer messages for plan mode keywords
3. Check all text parts of the last non-reflection user message

Added 25+ unit tests covering all detection paths including the
build-switch case (plan->build correctly returns false).

Closes #74
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.

reflection in a Plan mode

1 participant