DeepSeek-Reasonix icon indicating copy to clipboard operation
DeepSeek-Reasonix copied to clipboard

feat(desktop): persist tool approval mode per session/tab[Feature]:

Open wqq2026 opened this issue 5 months ago • 1 comments

Version line

v2 — Go rewrite (1.x), main-v2 (active development)

What problem does this solve?

🎯 Feature Request: Persist Tool Approval Mode Per Session / Tab

Target Repo: esengine/DeepSeek-Reasonix
Area: Desktop / Permissions / Sessions
Labels: desktop, enhancement


Problem

The tool approval mode (ask / auto / yolo) is not persistently bound to individual sessions or tabs. When switching between tabs or resuming a session, the mode resets to the default ("ask"), forcing the user to manually re-select it every time.

This is especially disruptive for:

  • A long-running YOLO analysis session → switching to another tab → switching back → back to "ask"
  • Maintaining multiple concurrent sessions with different trust levels (e.g., one research session in YOLO, one experimental session in "ask")
  • Resuming a session after the desktop app is restarted → mode forgotten

Evidence: Storage Already Exists

The desktop app already stores toolApprovalMode per tab in desktop-tabs.json:

{
  "tabs": [
    {
      "id": "tab_6f0cbe9ad64d0db5713a002a0897fd7e",
      "toolApprovalMode": "yolo"
    }
  ]
}

So the data model already supports per-session/per-tab mode, but the restore/apply logic when loading a session appears incomplete. The mode is written but not re-read and applied back to the session controller on tab switch or session resume.

Expected Behavior

  1. When a user selects a tool approval mode in a session, that mode is bound to the session for its entire lifetime.
  2. When switching back to that session (via tab switch, session resume, or desktop restart), the previously selected mode is restored automatically.
  3. New sessions default to the global [permissions] mode from config.toml (currently "ask").
  4. Users can still change the mode mid-session at any time, and the change persists for that session.
  5. Clear visual indicator of the current mode in the session header or status bar.

Suggested Implementation

Option A: Session Metadata Storage (Recommended)

Store the mode in the session metadata file (.jsonl.meta or goal-state.json):

{
  "id": "20260624-160614...",
  "tool_approval_mode": "yolo"
  // null = inherit global default
}
  • On session create: write null (uses global default)
  • On mode change: update the field
  • On session load: read and apply the stored mode

Option B: Fix Tab Config Persistence

The tab config (desktop-tabs.json) already stores toolApprovalMode. The gaps are:

  1. When creating a new tab, the mode should inherit from the user's last-used mode or global config — not always default to "ask"
  2. When switching tabs, the stored toolApprovalMode should be applied to the active session controller
  3. When restoring tabs on desktop startup, the stored mode should be applied

Option C: Config-Level Default Per Workspace

Add a config option for the default mode of new sessions:

[session]
default_tool_approval_mode = "ask"  # "ask" | "auto" | "yolo"

User Flow Example

1. User starts Session A (data analysis) → switches to YOLO
2. User starts Session B (experimenting) → keeps default "ask"
3. User switches back to Session A → YOLO is restored automatically
4. User temporarily changes Session A to "auto" → new choice persists
5. User closes and reopens the desktop → Session A restores with "auto"
6. Session B remains "ask" — completely independent

Why This Matters

The session/tab system is one of Reasonix's strengths over CLI-only agents. But the mode-reset-on-switch behavior undermines it — users end up micro-managing permissions instead of focusing on their work. This fix is relatively small (the data field already exists) and would significantly improve the multi-session UX.

Prior Art

  • PR #2728 already handles YOLO bypass for plan mode — this is a complementary UX fix
  • The [permissions] config section already supports mode = "ask"|"allow"|"deny" — session-level mode just extends this concept to individual sessions

Submitted via Reasonix agent by a daily desktop user

Proposed solution

No response

wqq2026 avatar Jun 24 '26 16:06 wqq2026

urgent need.

squigglefest avatar Jun 24 '26 19:06 squigglefest

Addressed by #5273, now merged.

What the merged fix covers:

  • Ask / Auto / YOLO now stays bound to the session/tab state instead of getting reset by stale or partial hydration data
  • switching back to an existing tab/session no longer demotes an explicit auto selection to ask
  • new sessions now seed their initial approval mode from the global desktop setting instead of inheriting the active tab's approval axis by accident
  • desktop-only defaults stay in the global settings file and do not leak into project reasonix.toml

Closing this as resolved by the merged desktop/session persistence fix. If you still have a remaining path that reproduces after #5273, please open a follow-up with the exact switch/resume/restart steps and we can narrow that flow down separately.

SivanCola avatar Jun 25 '26 07:06 SivanCola

Closing as resolved by merged PR #5273. If any remaining approval-mode reset path still reproduces after that change, please open a focused follow-up with exact repro steps.

SivanCola avatar Jun 25 '26 07:06 SivanCola