apache / apache/maka

feat(desktop): add a CodeMode preference

Open
#2,578 1 comment 0 reactions 1 assignee Claimed by @Astro-Han View on GitHub
enhancement
Dominant language
TypeScript
Stars
5.4k
Forks
502
Avg merge
1d 2h
Merged PRs (30d)
715

Description

## Problem

CodeMode is available through the Runtime's explicit per-run `toolMode`, but the standard Desktop product has no user-facing way to select it. Direct remains the only effective product default.

## Decision

Add one persisted tool-mode preference to the existing chat defaults settings:

- `auto`
- `direct`
- `code_mode`

`auto` is the default and currently resolves to `direct` for every model. `direct` and `code_mode` are explicit user overrides.

Resolve the preference once at the product boundary into the existing Runtime `ToolMode`. Do not add `auto` to Runtime execution, duplicate the tool surface, or create another CodeMode path.

## Scope

- Add the closed preference type and settings normalization.
- Add the selector to Settings alongside the existing chat defaults.
- Propagate the resolved mode when creating a new run.
- Persist the effective `direct` or `code_mode` value in the existing AgentRun record.
- Show a clear unavailable state if the selected backend cannot execute CodeMode.
- Preserve older settings files by normalizing a missing value to `auto`.

## Acceptance

- Existing settings resolve to `auto`, which currently produces Direct behavior.
- Selecting Direct never exposes `exec`.
- Selecting CodeMode exposes the existing `exec` path without changing tool authority or settlement.
- The setting survives restart and applies to new runs.
- Unsupported backends do not silently ignore an explicit CodeMode selection.
- No model is automatically enabled by this issue.

## Non-goals

- Choosing model-specific defaults.
- Adding CodeModeOnly.
- Changing the CodeMode executor or Runtime tool contract.
- Adding another tool registry, permission path, or execution mode.

Part of #1383.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.