[PR #1248] [MERGED] feat: pass mode into task tool #9859

Closed
opened 2026-02-16 18:14:17 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/1248
Author: @yihuikhuu
Created: 7/23/2025
Status: Merged
Merged: 7/23/2025
Merged by: @thdxr

Base: devHead: store-mode-message-use-in-task-tool


📝 Commits (4)

  • b772df9 feat: store mode in message. pass mode into task tool
  • 25a59be chore: clean up
  • 8ec28da chore: move mode to base message type
  • 303824c feat: only store mode on assistant message

📊 Changes

4 files changed (+24 additions, -2 deletions)

View changed files

📝 packages/opencode/src/session/index.ts (+5 -2)
📝 packages/opencode/src/session/message-v2.ts (+2 -0)
📝 packages/opencode/src/storage/storage.ts (+16 -0)
📝 packages/opencode/src/tool/task.ts (+1 -0)

📄 Description

Currently the task tool is always called with the build mode. In some cases this can cause unexpected behaviour, e.g. even if you have disabled write/edit/bash access in a custom mode, it can get around this restriction by calling the task tool to spawn a build session.

This PR updates the task tool to use the same mode as the parent session. It also updates the message format to store the mode that the message was called under (and uses this to access the parent message's mode).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/1248 **Author:** [@yihuikhuu](https://github.com/yihuikhuu) **Created:** 7/23/2025 **Status:** ✅ Merged **Merged:** 7/23/2025 **Merged by:** [@thdxr](https://github.com/thdxr) **Base:** `dev` ← **Head:** `store-mode-message-use-in-task-tool` --- ### 📝 Commits (4) - [`b772df9`](https://github.com/anomalyco/opencode/commit/b772df950cb10f4e92b66f215a981c30ffa5d2f9) feat: store mode in message. pass mode into task tool - [`25a59be`](https://github.com/anomalyco/opencode/commit/25a59bea0baf3680cce7b04460a6b602e2c580d2) chore: clean up - [`8ec28da`](https://github.com/anomalyco/opencode/commit/8ec28da813f9468e87a09f7323ded548a322579c) chore: move mode to base message type - [`303824c`](https://github.com/anomalyco/opencode/commit/303824c009fcdeddb28c4b0a158b8d294bc0442d) feat: only store mode on assistant message ### 📊 Changes **4 files changed** (+24 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/opencode/src/session/index.ts` (+5 -2) 📝 `packages/opencode/src/session/message-v2.ts` (+2 -0) 📝 `packages/opencode/src/storage/storage.ts` (+16 -0) 📝 `packages/opencode/src/tool/task.ts` (+1 -0) </details> ### 📄 Description Currently the task tool is always called with the `build` mode. In some cases this can cause unexpected behaviour, e.g. even if you have disabled write/edit/bash access in a custom mode, it can get around this restriction by calling the task tool to spawn a `build` session. This PR updates the task tool to use the same mode as the parent session. It also updates the message format to store the mode that the message was called under (and uses this to access the parent message's mode). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:17 -05:00
yindo closed this issue 2026-02-16 18:14:17 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9859