Skip to content

feat(connection): give each agent session and each backup or restore its own connections - #770

Merged
EVWorth merged 1 commit into
mainfrom
claude/hopeful-bardeen-1k4d1h
Oct 19, 2026
Merged

EVWorth merged 1 commit into
mainfrom
claude/hopeful-bardeen-1k4d1h

Conversation

@EVWorth

@EVWorth EVWorth commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Closes #731. Follows #769.

Why

After #769 the agent and job lanes were still one pool each per profile. Concurrent agent sessions shared two connections, and a backup and a restore shared the job lane's two. One agent's long query could hold up another, which FR-6.3.2 says shouldn't happen.

Change

Routing (mas-core)

  • Route replaces Lane. It has four variants:
    • Interactive: schema browsing, dialogs and admin; a fixed 3 connections.
    • Session(tab): an editor tab's own connection.
    • Agent(session): one agent session's connections.
    • Job(id): one backup or restore.
  • Agent sessions: up to AGENT_SESSION_MAX = 2 connections each, because agents call tools in parallel. They open on first use, close after 60s idle, and close when the session ends (close_agent_session).
  • Jobs: start_job returns a JobConnection, one connection that closes when it is dropped, however the job ends (finished, failed or cancelled).
  • Disconnect closes agent and job connections along with everything else.
  • Busy messages, per route:
    • A full agent session says so and that the editor and other agents aren't affected.
    • A job's connection is its own, so it is never reported as busy.
    • The editor-tab message is unchanged, now produced by the same function.

MCP

  • The endpoint already creates one server per MCP session. It now asks the workspace for a per-session one through a new Workspace::for_session hook, which defaults to sharing.
  • AppWorkspace gives each session its own Route::Agent for queries, staged writes, DDL, EXPLAIN and schema reads. Staged writes and Cancel still work across sessions.

Docs: FR-6.3.2 and AI_INTEGRATION §6 describe per-session connections.

Tests

  • Live, MySQL 8.0: full suite (mas-core, mas-admin, mas-mcp), 210 passed.
  • Live, MariaDB 11: connection_lanes, connection_health, editor_sessions, backup_dump, restore_file and staged_write, 53 passed.
  • New live tests in connection_lanes check that:
    • two agent sessions get different server connections, and a full one doesn't hold up the other;
    • a full agent session is reported as the agent's;
    • agent sessions cost nothing until used and close when they end;
    • a job gives its connection back when dropped;
    • agent and job threads are known as the app's own ([P1] [security] kill_process has no self-protection — can kill own admin connection #433);
    • disconnect closes agent and job connections;
    • Cancel still stops an agent's query.
  • Unit tests: 450 pass across mas-core, mas-mcp and the app crate.
  • Linters: clippy -D warnings, rustfmt and dprint are clean.
  • Bindings: bindings.ts is unchanged, since no commands or exported types changed.

Generated by Claude Code

…its own connections

The agent and job lanes were one pool each per profile, so concurrent agent
sessions shared two connections, and a backup and a restore took the job
lane's two. Each kind of work now has connections of its own (#731):

- Route replaces Lane: Interactive, Session (editor tab), Agent (one agent
  session) and Job (one backup or restore).
- Agent sessions: the MCP endpoint already builds a server per session;
  it now asks the workspace for a per-session one, whose queries, staged
  writes, DDL, EXPLAIN and schema reads go to Route::Agent(session). Up to
  AGENT_SESSION_MAX (2) connections, since agents call tools in parallel;
  opened on first use, closed after a minute idle and when the session's
  workspace is dropped. FR-6.3.2 holds per session, not per profile.
- Jobs: start_job opens one connection for the backup or restore and
  closes it when the JobConnection is dropped, however the job ends.
  Disconnect closes agent and job connections as before.
- Busy messages are per route: an agent session says so and that the
  editor and other agents are unaffected; a job's connection is its own
  and is never reported as busy.

Closes #731.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
@EVWorth
EVWorth merged commit 78d7c6f into main Oct 19, 2026
12 checks passed
@EVWorth
EVWorth deleted the claude/hopeful-bardeen-1k4d1h branch October 19, 2026 23:46
EVWorth added a commit that referenced this pull request Oct 20, 2026
* release: 1.3.0

Version bump across the three manifests and the two lockfile entries
that record the app's own version.

1.2.0 and 1.2.1 were bumped but never tagged, so 1.3.0 is the first
release since 1.1.0 and carries everything since it:

Connections (#731)
- Each editor tab runs on its own server session, so SET @var, SET
  SESSION, temporary tables and multi-run transactions carry over (#734)
- Each agent session, and each backup or restore, has connections of its
  own, so none of them can hold up the editor or each other (#732, #770)
- The Min/Max pool size setting and the status-bar pool counter are gone;
  connections are no longer something to size (#769)
- A "busy" error says what is busy and what to wait for (#727)

Grid
- Grid edits save on the tab's session without committing its open
  transaction (#762)
- Copy a long cell value without opening the viewer (#748)

Fixes
- Linux: WebKitGTK's DMABUF renderer is off under Wayland (#742)
- rustls for RUSTSEC-2026-0285 and RUSTSEC-2026-0346..0349 (#728, #759)
- Tauri 2.12.3, tauri-plugin-updater 2.13.3, tauri-plugin-shell 2.5.0
  (#749, #747, #758), and dependency roll-ups

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* fix(deps): bump rustls-webpki and webpki-roots for RUSTSEC-2026-0381..0383

rustls-webpki 0.103.16, webpki-roots and webpki-root-certs 1.0.10. The
advisories were published today: certificate verification could accept
distrusted intermediates, and the bundled roots still trusted the
distrusted emSign intermediates. cargo audit fails on all three, and a
release should not ship them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

---------

Co-authored-by: Claude <[email protected]>
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.

Connections: give each kind of work its own connection instead of one shared pool

2 participants