Skip to content

fix: open Project chats when gateway lacks projects.assign_session - #101

Open
Thaeland wants to merge 5 commits into
rusty4444:mainfrom
Thaeland:fix/project-chat-cwd-binding
Open

Thaeland wants to merge 5 commits into
rusty4444:mainfrom
Thaeland:fix/project-chat-cwd-binding

Conversation

@Thaeland

@Thaeland Thaeland commented Sep 14, 2026

Copy link
Copy Markdown

Problem

Project chats are blocked against stock Hermes: the commit-before-open path requires projects.assign_session, which upstream has never shipped (git log -S across the full history: zero hits). The gateway answers -32601, the client treats it as fatal, and the chat never opens. Full analysis in #100.

Fix

Make the missing sibling non-fatal and bind the chat through the mechanism stock Hermes actually honors — the session cwd:

  • workspace_screen.dart — catch ProjectsUnsupportedException around the assign call: explanatory snackbar, chat opens anyway. Other errors keep the existing blocking + Retry.
  • new_chat_options.dartNewChatDraft carries projectWorkingDirectory (project primary_path / first folder).
  • chat_screen.dart / desktop_gateway_client.dart — thread it through ensureSession_connect_resumeOrCreate.
  • ws_client.dartcreateOrResumeSession(sessionId, {workingDirectory}) forwards it as cwd on session.create; upstream persists it and groups the session under the project via project_for_path on the next tree refresh.

A future gateway that ships projects.assign_session still wins — cwd binding is only the fallback.

Verification

  • flutter analyze: no issues
  • flutter test: 947/947 pass
  • Release APK builds and signs (arm64, verified with apksigner)

Closes #100. Related: #84, #87 (same contract gap — validated against tools/fake_gateway/, not stock Hermes).

Stock Hermes hosts the projects.* family but never shipped
projects.assign_session; the commit-before-open call failed with
-32601 and blocked every Project chat. Treat that sibling as
unsupported (snackbar + open anyway) and bind the chat via the
project's working directory on session.create cwd, which upstream
uses for project_for_path grouping. Explicit assignment still
wins when a future gateway ships it.

flutter analyze clean; 947/947 tests pass.
- FilingGatewayClient: filing.status/rules/suggest/apply/reject with the
  same unknown-method degradation discipline as ProjectsGatewayClient
- DesktopGatewayClient.filing accessor on the shared control transport
- FilingScreen: suggestions with File it / Never here, contract rules,
  exclusions, and the audit trail
- More pane: ai-filing is capability-gated on a live filing.status probe
  instead of hard-coded unavailable
@Thaeland
Thaeland force-pushed the fix/project-chat-cwd-binding branch from 2b48c5a to 2fb4700 Compare September 15, 2026 03:37
- OrganizationGatewayClient for the gateway organization.* RPC with the
  same unknown-method degradation as filing/projects
- Long-press enters selection mode in Chats and Smart Views (only when
  the gateway proved organization.*); action bar: select all, pin,
  unpin, archive, cancel
- Every batch gets an Undo snackbar wired to organization.undo; partial
  server failures surface instead of silently succeeding
- More pane: pin-batch-undo entry capability-gated on organization.history;
  routes to the chat list where the batch surface lives
Stock Hermes SessionCreateParams (tui_gateway/contracts/sessions.py)
forbids extra inputs and mints its own runtime id + stored key; the
fixture-only session_id param made every new-chat create fail with
'invalid params for session.create: session_id: Extra inputs are not
permitted'. The create call now sends only cwd (when set); the
gateway-minted id flows back through the existing result mapping.

flutter analyze clean; 949/949 tests pass.

@rusty4444 rusty4444 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested.

Blocking: the claimed stock-Hermes fallback still sends session.create both session_id and cwd. The current stock gateway's SessionCreateParams accepts cwd but explicitly rejects session_id as an extra field. A direct contract probe returned Extra inputs are not permitted, so a new mobile draft that cannot resume will still fail instead of opening in the selected project directory. Update the client to the real session.create contract, reconcile the returned gateway session ID, and add a regression test against that request shape.

Scope/contract: the second commit adds 627 lines of AI-assisted filing UI/client code for a filing.* RPC family that is not present in stock Hermes and is unrelated to this PR's stated project-chat fix. Please split it into a separate PR and pair it with a concrete backend contract, or document and test the actual compatible server implementation.

Local checks completed after dependency resolution: changed-file analysis passed and all 19 more_pane_test.dart tests passed. Those tests cover only entry gating; they do not exercise the new session-create fallback or FilingGatewayClient, so they do not resolve the contract blocker. No GitHub CI checks are currently visible.

The More-pane Assets entry was hardcoded unavailable pending a
server-authoritative index; the gateway now ships one (assets.status /
assets.list), so the entry is capability-gated like filing and
pin-batch-undo: lazy probe on first pane open, honest reason when the
gateway lacks the family.

- AssetsGatewayClient mirrors the filing client's unknown-method discipline
- AssetsScreen: kind filters (All/Artifacts/Attachments/Media), pull-to-
  refresh, tap copies the server path
- more_pane: assetsAvailable drives the entry; new gating test
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.

Project chats permanently blocked: projects.assign_session does not exist on stock Hermes gateways

2 participants