Skip to content

feat(desktop): add Tauri commands to end and recover remote thread sessions - #17

Draft
tee8z wants to merge 1 commit into
dev-2884-agent-provider-lifecyclefrom
dev-2884-remote-session-commands
Draft

tee8z wants to merge 1 commit into
dev-2884-agent-provider-lifecyclefrom
dev-2884-remote-session-commands

Conversation

@tee8z

@tee8z tee8z commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

The desktop cannot end a thread-sandbox session or recover one that ended. This PR adds three Tauri commands and their TypeScript bindings in desktop/src/shared/api/tauriManagedAgents.ts. A provider advertises stop in a new optional info.ops array. The desktop sends the secret-bearing stop request only after the same staged binary advertised stop. The recovery mode goes into the provider config for one invocation and is never saved on the agent record.

sequenceDiagram
  participant D as Desktop frontend
  participant T as Tauri command
  participant P as Provider binary (staged copy)
  D->>T: remote_agent_session_supports_lifecycle
  alt provider agent with a thread sandbox
    T->>P: info
    P-->>T: ops
    T-->>D: whether ops contain stop
  else local agent or no thread sandbox
    T-->>D: false
  end
  D->>T: end_remote_agent_session or recover_remote_agent_session
  Note over T: Per-agent lock, payload rebuilt from the record, tenant scope asserted, thread session bound
  alt end_remote_agent_session on a thread sandbox
    T->>P: info
    P-->>T: ops
    alt ops contain stop
      T->>P: stop (agent, provider_config)
      P-->>T: state ending, ended, or absent
    else ops do not contain stop
      T-->>D: error, stop is not sent
    end
  else recover_remote_agent_session
    T->>P: info
    T->>P: deploy, provider_config.sandbox.recovery.mode = checkpoint or fresh
    P-->>T: agent_id
    T-->>D: updated ManagedAgent
  end
Loading
  • managed_agents/backend.rs: advertised_ops accepts at most 32 non-empty strings. A provider without ops gets ["info", "deploy"]. A stop response must report ending, ended, or absent.
  • commands/agents/provider_deploy.rs: deploy_to_provider now uses lock_provider_operations and prepare_provider_invocation, which end_remote_agent_session also uses. bind_sandbox_scope refuses a recovery mode when the record has no thread sandbox.
  • commands/agents/remote_session.rs: the three commands, registered in lib.rs.
  • Nothing in the UI calls the new bindings yet. The next layer adds the thread recovery banner.

Delivery scope

This PR supplies the native commands and capability negotiation used by explicit remote-session end and recovery. Shared invocation helpers preserve the existing deployment lock and tenant checks for those operations. Broader client architecture changes and GPUI integration are deferred.

The provider starts advertising info.ops in this layer, alongside the compatible desktop reader. Rollout order: ship this desktop reader before upgrading any separately installed provider that advertises ops. Earlier layers keep the legacy info shape.

Stack

Position 15 of 23. Base: #2. Next: #3. Each PR contains one signed commit. #27 fixes the existing message-edit CI failure, and #29 fixes transient provider launch conflicts. #24 and #25 repair fork CI and security prerequisites; the feature layers remain scoped to remote agents.

Validation

  • Integrated desktop suite: 6,832 Node tests and 164 jsdom tests passed. TypeScript checking passed.
  • Integrated provider and reaper suite: 237 tests passed; the live-controller test also passed against the isolated local kind cluster.
  • Signed stack and per-layer parentage verified. Workspace Rust Clippy, desktop lint, Rust formatting, file-size checks, and the desktop build passed. Native Clippy passed with default features and with mesh-llm. The integrated desktop native suite passed 3,445 tests, and 30 parallel provider-test repetitions passed. The final frontend and static checks passed on the published revision. Full local just ci has not passed as one run: two unchanged mobile tests timed out in the full suite and passed in isolation; all 27 terminal unit tests passed in an isolated Linux container that supplies the standard tools missing from the Nix host. Updated GitHub checks are pending.

Limits

Native IPC, the staged provider binary, and the real desktop flow require runtime acceptance. Automated TypeScript tests do not establish that acceptance.

Human workflow confirmation is still required by AGENTS.md before readiness. Human acceptance has not been confirmed.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@tee8z
tee8z force-pushed the dev-2884-remote-session-commands branch from a154b26 to c18f4e7 Compare October 20, 2026 14:53
@tee8z
tee8z removed this pull request from stack #22 October 20, 2026 14:56
@tee8z
tee8z added this pull request to stack #26 October 20, 2026 14:56
@tee8z
tee8z force-pushed the dev-2884-remote-session-commands branch from c18f4e7 to 0a2bf27 Compare October 20, 2026 15:01
@tee8z

tee8z commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

Please review the current revision against this PR’s immediate stack base. The descriptions document the remote-agent scope, regression coverage, and outstanding runtime validation.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. Your current included review allowance is based on your included PR review attempts over the past 7 days. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 59 minutes.

@tee8z
tee8z force-pushed the dev-2884-remote-session-commands branch 2 times, most recently from 5f59e7e to f4bd7e5 Compare October 20, 2026 16:24
@tee8z
tee8z removed this pull request from stack #26 October 20, 2026 16:24
@tee8z
tee8z added this pull request to stack #28 October 20, 2026 16:25
@tee8z
tee8z force-pushed the dev-2884-remote-session-commands branch from f4bd7e5 to a30d073 Compare October 20, 2026 16:51
…ssions

Add the backend half of explicit thread-session lifecycle control for
thread-sandbox providers. Providers may advertise `ops` in `info`;
`provider_stop` sends the secret-bearing `stop` request only after the
same staged bytes negotiated protocol v1 and advertised `stop`.

New commands `end_remote_agent_session`, `recover_remote_agent_session`
and `remote_agent_session_supports_lifecycle` share the deploy path's
per-agent lock, post-lock payload rebuild, tenant scope assertion, and
session binding. The recovery mode rides one invocation's provider
config and is never persisted on the agent record.

Expose typed TypeScript bindings for the three commands.

Signed-off-by: Tee8z <tee8z@protonmail.com>
@tee8z
tee8z removed this pull request from stack #28 October 20, 2026 17:22
@tee8z
tee8z force-pushed the dev-2884-remote-session-commands branch from a30d073 to 85a9520 Compare October 20, 2026 17:22
@tee8z
tee8z added this pull request to stack #30 October 20, 2026 17:22
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.

1 participant