Skip to content

fix(mobile-web): derive chat header from the session workspace - #3665

Merged
bobleer merged 6 commits into
openBitFun:mainfrom
bobleer:bob/mobile-assistant-session-header
Nov 2, 2026
Merged

bobleer merged 6 commits into
openBitFun:mainfrom
bobleer:bob/mobile-assistant-session-header

Conversation

@bobleer

@bobleer bobleer commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The mobile web chat header now takes its workspace line from the session being opened, not from the store's selected workspace. Assistant/Claw sessions show the assistant name and no branch. A normal session shows its own workspace, and a branch only when that workspace is the currently selected one, because that is the only workspace whose branch mobile web knows.

Fixes #2360

Type and Areas

Type: Bug fix

Areas: Mobile web

Motivation / Impact

Opening a Claw session in BitFun Remote showed the previously selected project and branch (home / master), even though commands ran in the assistant workspace.

  • SessionListPage now passes a SessionWorkspaceContext when a session is selected or created. Its display name and kind come from the owning catalog row, or from the mode-scoped selection for the flat list, because the host's workspace_name is only a root label.
  • App keeps that context and adds it to the tab navigation record, so a reload restores the same header. The field is additive.
  • resolveChatHeaderContext (in workspaceIdentity.ts) derives the header. isClawAgent moved there from SessionListPage, unchanged.
  • Normal sessions with no known workspace facts now show no workspace line instead of guessing from the selection. This can only happen for navigation restored from an older build, before the session row loads.

Native mobile apps (Kotlin, HarmonyOS) are not changed. The issue reports the relay web UI, and I did not check whether the native headers have the same problem.

Verification

Run locally in src/mobile-web, all passing:

  • pnpm --dir src/mobile-web run type-check
  • pnpm --dir src/mobile-web run test:workspace-identity (35): assistant, other-project, same-path SSH hosts, localhost markers from older hosts on either side, the rollback gate, and selections that no longer own a created session
  • pnpm --dir src/mobile-web run test:account-login (18): navigation records from older builds, and malformed workspace values
  • pnpm --dir src/mobile-web run test:ui-components (18)
  • pnpm --dir src/mobile-web run test:account-browser (21): includes a new test using the real sidebar and ChatPage in Chrome at 390px and 1280px, with host IO simulated and home / master selected. It checks a new Claw session, an existing Claw session, the selected project (home, master) and another project (api, no branch).
  • pnpm --dir src/mobile-web run test:chat-transcript-browser, test:rollback-browser, test:session-stream-browser
  • pnpm run build:mobile-web

Regression check: with the old header logic temporarily restored, the new browser test fails with { workspace: 'home', branch: 'master' }, which matches the issue.

Remote scenarios:

  • Remote control: exercised only against a simulated host in the browser fixture. Not run against a live relay, desktop host or physical device, and no visual QA was done beyond the tests' DOM checks.
  • Remote workspace (SSH): header and rollback gate covered by unit tests only, not against a real SSH workspace.
  • Peer Device Mode, Detached Dispatch: not exercised. No host, wire protocol or Web UI code changed.

Locale files are unchanged because the fallback label reuses shared.agents.Claw, so the i18n audit was not run.

Reviewer Notes

  • Compatibility: session.workspace in openbitfun.mobile.navigation.v1 is optional. Older builds ignore it, and new code reads records without it and drops malformed values.
  • Rollback gate (behavior change): the SSH gate from 6bb577b read currentWorkspace, so it could offer rollback on an SSH session while a local project was selected, or hide it on a Claw or local session while an SSH project was selected. isRemoteSessionWorkspace now decides from the same session context as the header. Only Claw/assistant or a context with explicit routing facts can decide alone. A context with no routing facts (for example an old cached row with only a path) is treated as unknown, and stays gated if currentWorkspace is remote or a known workspace with the same ID or root is remote.
  • Known limit of the gate: "known workspaces" means the catalog the session list loaded (new store field knownWorkspaces). Until it loads, such as right after a restore, only currentWorkspace can gate an unknown context.
  • Device name: when a control target has a device name, the header still shows the device instead of the workspace, as before. The bug is only visible without one.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

The chat header read the store's selected workspace, so opening a Claw
session showed the previously selected project and branch.

Pass the session's workspace context when a session is opened and keep it
in the tab navigation record. Assistant sessions show the assistant name
and no branch; normal sessions show their own workspace and a branch only
when it is the currently selected workspace.

Fixes openBitFun#2360
The rollback gate read the selected workspace, so a session opened from
another workspace could get the wrong answer. Decide it from the same
session context as the header.

Also compare localhost markers from older hosts on both sides when matching
the selected workspace, apply a selected owner to a created session only when
it matches, and clear the session workspace when leaving the chat.
A path-only session context, such as an old cached row, read as local and
could offer rollback on an SSH workspace. Treat it as unknown: it stays gated
if the selected workspace or a known workspace with the same ID or root is
remote. Only Claw/assistant or explicit routing facts can override a remote
selection.
@bobleer
bobleer merged commit 820e7f5 into openBitFun:main Nov 2, 2026
9 checks passed
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.

[Remote] Assistant sessions display the wrong workspace and branch

1 participant