Repository navigation
feat(ai): add remote coding agent sessions for SSH hosts - #1545
Merged
Merged
Conversation
ZacharyZcR
marked this pull request as ready for review
October 2, 2026 04:56
Agent sessions lived in a single ctx.kv value holding up to 2000 events, which passed the 256 KB kv limit within minutes of a normal run. Every save after that failed, so history, nativeId, queue and archive changes were lost and every event wrote a kv audit row. Sessions, events and queued prompts now have their own tables. A running agent appends events in batches at most once a second with a lazy save; session and queue changes save immediately. Prompts, drafts and stored event text are capped in UTF-8 bytes to fit MySQL TEXT. kv:own is no longer requested. The OpenCode server now requires a per-session password, so other local accounts on the host cannot drive the agent through its loopback port.
…store # Conflicts: # plugins/ai/locales/en.json # plugins/ai/locales/translated/zh_CN.json
LukeGus
pushed a commit
that referenced
this pull request
Oct 3, 2026
* feat(ai): add host coding agent sessions with configured providers * Wait for agent initialization and shutdown before resuming sessions * Keep Pi transcripts outside its configuration migration directory * Cover Pi session directory separation * Update core permission catalog expectations for remote agents * Install remote agent runtimes from verified official sources * Wait for the identity panel credentials request in its test * Add scoped SSH forwarding setup for remote agents * Verify forwarding setup through a fresh SSH connection * Bound the SSH forwarding verification timeout * Return the forwarding verification callback result * fix(ai): support agent send and interrupt keyboard shortcuts * feat(ai): add agent queues attachments worktrees and session recovery * fix(ai): handle deleted workspace paths and duplicate status events * fix(ai): accept file references in root workspaces * fix(ai): refresh paused queues after agent errors * fix(ai): store agent sessions in plugin tables and lock down OpenCode Agent sessions lived in a single ctx.kv value holding up to 2000 events, which passed the 256 KB kv limit within minutes of a normal run. Every save after that failed, so history, nativeId, queue and archive changes were lost and every event wrote a kv audit row. Sessions, events and queued prompts now have their own tables. A running agent appends events in batches at most once a second with a lazy save; session and queue changes save immediately. Prompts, drafts and stored event text are capped in UTF-8 bytes to fit MySQL TEXT. kv:own is no longer requested. The OpenCode server now requires a per-session password, so other local accounts on the host cannot drive the agent through its loopback port. * test(upgrade): include agent session tables in the reviewed upgrade SQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add an AI Agent action to host cards and SSH terminal toolbars. Users can run Pi, OpenCode, Claude Code, or Codex on an SSH host with their existing Termix AI Provider, streamed replies, tool activity, native permission prompts, cancellation, stop/resume, and saved history. The implementation uses native CLI protocols without a Paseo dependency.
The host panel includes an official runtime installer and a separate scoped SSH forwarding setup action. Node.js comes from nodejs.org with SHA-256 verification; fixed official agent packages come from registry.npmjs.org with locked SHA-512 integrity. Installation uses an isolated user prefix and disables third-party registries and lifecycle download scripts. Forwarding setup backs up and validates a source/account-scoped loopback rule, reloads OpenSSH with rollback on failure, and verifies an actual bind through a fresh SSH connection.
Conversation workflow
Boundaries
Provider secrets stay server-side behind an authenticated, inference-only SSH reverse proxy. Host access, AI opt-in/RBAC, selected model, and the existing private-endpoint allowlist are enforced. Targets require Node.js 22.19+, a selected CLI, and loopback remote forwarding. Claude requires Anthropic Messages; Codex requires Responses support. Pi tools run with the SSH account's authority. The UI retains the most recent 2,000 events; native history remains on the host. No mobile-native UI or cross-host migration is included.
Also fix an existing timing-sensitive identity test by awaiting its asynchronous credentials request.
Validation
See
plugins/ai/AGENTS-FEATURE.mdfor permissions, persistence, limits, and runtime requirements.