BitFun icon indicating copy to clipboard operation
BitFun copied to clipboard

[Bug]: New Session shows a false "permission mode could not be read" error before the host creates it

Open QZQ-go opened this issue 3 weeks ago • 0 comments

Summary

On OpenBitFun 1.0.9, every new Session immediately shows the error notification “无法读取此会话的权限模式,当前显示的是默认模式。” (chatInput.permissionMode.unread — “Could not read this session's permission mode. Showing the default mode instead.”).

The Session itself is fine: the first message sends normally and runs with the default permission mode, and nothing is lost. The report is a false alarm: the permission mode is read for a Session that the host has not created yet.

Root cause, from the logs and the 1.0.9 changes:

  • 4894b75 perf(session): read permission overrides without restoring cold sessions replaced ensure_session_loaded_for_selector_update with read_session_header_for_selector in get_session_permission_mode, so the mode now comes from a persisted Session header instead of loading the Session.
  • A new Session exists only in the Web UI (id + “新会话”) until the first message is sent. Its sessions/<id>/ directory and metadata.json are created at that point.
  • The ChatInput effect fires as soon as the new Session becomes active, so the read runs against a Session that does not exist on the host yet and returns Not found: Session not found: <id>.
  • #3169 intentionally turns a failed read into a user-visible “unread” notification. For an unmaterialized Session this is a false positive and reads like an error.

Expected: a Session that has not been created on the host yet should be treated as “inherits the default mode” (like a draft), not reported as unreadable.

Area

Desktop app

Reproduction or evidence

  1. OpenBitFun 1.0.9, local workspace, any Session open.
  2. Click New Session.
  3. The error notification appears immediately, before anything is typed.
  4. Send the first message — it succeeds, and the Session directory appears under ~/.openbitfun/projects/<project>/sessions/<id>/.

Host log at the moment of creation (ids shortened):

[2026-11-06T10:04:35.274][ERROR][webview] [TauriAdapter] Request failed {"action":"get_session_permission_mode","error":"Not found: Session not found: e418eec2-…"}
[2026-11-06T10:04:35.274][WARN][webview] [ChatInput] Failed to read session permission mode TauriCommandError: Not found: Session not found: e418eec2-…

Fourteen seconds later, when the first message is sent:

[2026-11-06T10:04:49.947][DEBUG][webview] [AgenticEventListener] Session created: {… "sessionId":"e418eec2-…", "sessionName":"新会话" …}

Frequency: 11 occurrences after upgrading to 1.0.9, 0 occurrences in the logs from the previous build (Nov 1–4) for the same workflow. Sessions that are created and never sent have no directory on disk at all.

Related observation: the same command and error also appeared once for an existing Session right after a device-surface switch failed (Device surface switched … "reason":"switch_failed"), so the same “no host record” path may be reachable without a brand-new Session.

Suggestion: skip the permission read while the Session is a draft/unmaterialized, or treat not found on this first read as “default mode” and keep the unread notification for the remaining failure reasons (session_in_use, outcome_unknown, …).

Environment, if relevant

  • OpenBitFun 1.0.9, build 2026-11-05T10:31:50.963Z, commit 6d3176797deba01e8da71b066e51556f4aa6eccd
  • macOS 27.2 (26B123), Apple Silicon
  • Desktop app, local workspace, single instance running (so this is not session_in_use)
  • The first message resolved resolved_permission_mode: auto_approve (the default) — no permission setting was lost

QZQ-go avatar Nov 06 '26 02:11 QZQ-go