Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

When a /compact command includes a continue message, the continue message was being queued with the compaction mode's tool policy (all tools disabled) instead of the intended execution mode's tool policy.

Root Cause

The bug existed since the feature was first implemented in PR #650 (Nov 21). The code spread compaction options into the queued message, which included the disabled-all tool policy from compact mode.

Fix

Add mode field to ContinueMessage type so the backend can derive the correct tool policy via modeToToolPolicy() instead of inheriting from compaction options.

Changes

  • src/common/types/message.ts: Add mode field to ContinueMessage
  • src/browser/utils/chatCommands.ts: Set mode when building continueMessage
  • src/browser/hooks/useResumeManager.ts: Preserve mode during resume
  • src/node/services/agentSession.ts: Use modeToToolPolicy(continueMessage.mode)
  • src/node/services/agentSession.continueMessageToolPolicy.test.ts: Regression test

Generated with mux • Model: anthropic:claude-opus-4-5 • Thinking: high

When a /compact command includes a continue message, the continue message
was being queued with the compaction mode's tool policy (all tools disabled)
instead of the intended execution mode's tool policy.

The bug existed since the feature was first implemented in PR #650 (Nov 21).
The code spread compaction options into the queued message, which included
the disabled-all tool policy from compact mode.

Fix: Add 'mode' field to ContinueMessage type so the backend can derive the
correct tool policy via modeToToolPolicy() instead of inheriting from
compaction options.

Files changed:
- src/common/types/message.ts: Add mode field to ContinueMessage
- src/browser/utils/chatCommands.ts: Set mode when building continueMessage
- src/browser/hooks/useResumeManager.ts: Preserve mode during resume
- src/node/services/agentSession.ts: Use modeToToolPolicy(continueMessage.mode)
@ammario ammario merged commit fd1bf0b into main Dec 21, 2025
20 checks passed
@ammario ammario deleted the compaction-kmbn branch December 21, 2025 17:55
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.

2 participants