Skip to content

fix: cancel reaches staged writes; shared test DBs - #900

Merged
EVWorth merged 3 commits into
mainfrom
claude/hopeful-bardeen-1k4d1h
Oct 25, 2026
Merged

EVWorth merged 3 commits into
mainfrom
claude/hopeful-bardeen-1k4d1h

Conversation

@EVWorth

@EVWorth EVWorth commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Two follow-ups, one commit each. Both were written by an implementer-rust subagent.

#894: cancel reaches an agent's staged writes and schema reads

Before this change, cancel only reached statements the executor tracked as in flight. Staged writes and schema-inspector reads ran on their own connections, so the panel's Stop missed them.

  • New query::in_flight::InFlightTracker, taken from QueryExecutor::tracker().
    • track(conn, connection_id, route) registers the connection's server thread and returns a ticket.
    • Dropping the ticket deregisters the thread. It only removes its own entry: the connection id and route must still match.
  • StagedWrite::begin_in(…, Option<CancelReach>) holds the ticket only while the user's statement runs, not while the transaction waits for approval. begin still exists.
  • SchemaInspector::tracked_by(tracker): all 16 reads share a private ReadConnection. A tracked inspector registers each read under its route; the UI's untracked inspector skips the extra round trip.
  • MCP workspace: the agent's inspector is tracked on Route::Agent(session), and stage_write uses begin_in. Both the panel's Stop (CancelScope::Agent) and CancelScope::All now reach these statements.
  • docs/design/AI_INTEGRATION.md §6: the stated limit is replaced with what is now covered. A staged write that has already run and is waiting for approval is deliberately left alone.

#895: test containers from any worktree

  • docker-compose.test.yml gets a top-level name: sqlpilot. That matches the project label on existing containers, so they are adopted with no reset.
  • just db-up uses up -d --no-recreate. Without it, each worktree's own seed bind-mount paths would make compose recreate the containers.
  • CONTRIBUTING.md and the integration-tests skill now say the containers are shared across checkouts.

Closes #894. Closes #895.

Test plan

  • New connection_lanes tests:
    • an_agent_cancel_reaches_its_staged_write: two agents each run a staged DELETE … WHERE SLEEP(20)=0. Cancelling agent a stops it within 5 s with nothing changed; agent b keeps running until CancelScope::All. The test fails when begin_in's registration is disabled.
    • an_agent_cancel_reaches_reads_outside_the_executor: covers the tracker path that the inspector uses.
  • Full mas-core integration suite with --ignored passes on MySQL 8 and on MariaDB 11. connection_lanes is 13/13 on both.
  • cargo fmt and cargo clippy --workspace --all-targets --all-features -- -D warnings are clean. cargo test -p mas-core (246 lib tests) and cargo test -p sqlpilot --lib (82) pass.
  • chore: test containers can't start from a second worktree #895, checked by running the recipe's commands:
    • With the old compose file, starting from a worktree reproduced the "container name already in use" conflict.
    • With the fix, up works from both checkouts, whether the containers are running or stopped, with unchanged container IDs, and both containers reach healthy.
    • A fresh db-down followed by db-up seeds correctly.

Generated by Claude Code

A staged write runs on its own connection and the schema inspector reads
through sqlx directly, so neither was in the executor's in-flight table and
the agent panel's Stop could not reach them. Both now register their
connection's thread under the agent's route while the statement runs, through
an InFlightTracker handle on the executor's table.

Closes #894.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
The compose file's fixed container names made db-up fail from a second git
worktree, whose default compose project differs. Pin the project name so
every checkout owns the same containers, and start them with --no-recreate
so a worktree's different seed mount paths do not replace them.

Closes #895.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
@EVWorth
EVWorth merged commit 885ee46 into main Oct 25, 2026
12 checks passed
@EVWorth
EVWorth deleted the claude/hopeful-bardeen-1k4d1h branch October 25, 2026 03:22
@github-actions github-actions Bot mentioned this pull request Nov 8, 2026
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.

chore: test containers can't start from a second worktree fix: cancel can't reach an agent's staged writes or schema reads

2 participants