← Back to Pull requests

feat(desktop): move a Session between installations from Settings #5197

Closed
unknown closed this pull request without merging on Sep 12, 2026 06:37 UTC
View on GitHub
unknown unknown commented on Sep 11, 2026 13:15 UTC
Author

Summary

Move a task between two Maka installations from inside the app, under #5182. The CLI could already do it — with Maka closed, which is the one state the user is not in when they reach for it.

Why the Runtime Host does the work

A Runtime Host takes the Storage Root owner at startup and holds it for its lifetime, and that lock is an election, not a mutex: it is taken with tryLock, and a second exclusive hold is refused even inside the process that already has one.

first  exclusive: true
second exclusive (same process, different fd): false

So the Host cannot reach these by calling them — it would be refused by its own lock. It lends the lease that #5186 taught the storage layer to accept.

Export walks the subagent subtree and fences it with runSessionSubtreeQuiescentMutation: it refuses while any of those Sessions has an active execution claim, so no Turn starts while the bundle is prepared. That is not the check the export already makes on its private copy — that one catches state already in flight, this one stops new state from arriving.

Import takes no Session fence. The Sessions it carries do not exist here yet, so there is nothing to fence by id; what has to be exclusive is the context store, and the import takes that turn itself.

Settings › Import/export tasks

Import. The bundle file is a source beside the agents — where is this conversation coming from — and the only one that is always available, since a file the user already has needs nothing installed.

<img src="https://raw.githubusercontent.com/Joob1n/maka-agent/c17f2d6737c109dbd8d42a0550f45ee11c04a388/docs/images/pr/session-bundle/import-maka-source.png" alt="The import half with Maka session file selected as the source" width="900">

Export. A bundle can be rooted at any node, so every row exports. The nesting says which subtree a row would carry, and the count on a parent is the whole subtree rather than its children — the root here carries three, not two. A row with descendants asks before writing them.

<img src="https://raw.githubusercontent.com/Joob1n/maka-agent/c17f2d6737c109dbd8d42a0550f45ee11c04a388/docs/images/pr/session-bundle/export-tree.png" alt="The export half showing a subagent subtree with nesting rules" width="900">

Both are product-settings-pages--import-tasks and --import-tasks-export in Storybook; the second is new here.

Tests

15 new, across three layers.

session-bundle-export-tree (6): a subtree nests and counts the whole tree rather than one level; the link is read from the field the catalog actually publishes; a task whose parent is not in the list still appears; a Session naming itself as its parent still renders; archived tasks stay out; and every row offers its own export, because a bundle can be rooted at any node. The invariant these protect is that every task the user could export appears exactly once — nesting is the nicety.

runtime-host-session-bundle-ipc-main (6): the destination reaches the Host and the count is the subtree; a closed save dialog asks the Host for nothing; each imported Session is published so the shell re-reads its catalog; a reason code a reader can act on survives; a failure no code describes keeps its message; and a task name cannot steer the proposed filename.

session-bundle-coordinator (3): export runs inside the Session fence, import does not, and a fence that refuses a running Session refuses the export.

Each was checked by reverting the implementation it covers — reading only subagentParent, treating a self-referencing row as nested, hiding a row whose parent is absent, dropping the catalog publication, losing the failure message, calling the Host after a cancelled dialog, and removing the export fence. Every one turns the matching test red.

The round trip was also run end to end against a real workspace: a task with a 4-Session subtree exported to 19,711 bytes, imported into an empty workspace as 5 Sessions with all 4 subagent_spawns links and a clean foreign_key_check, and refused with session_exists on a second import.

Two things this fixed in passing

The harness had no ToastProvider. The page asks for a confirmation before exporting a subtree, and a confirmation is a toast. The app has always provided one; the test harness did not, so every case failed on the provider rather than on the case.

Two controls answered to the same name. The mode switch was labelled Import / Export, and a row's action is called Export too. A person tabbing through reached the wrong one — and so did the tests. The switch now has its own label and names no row action shares.

Gates

@maka/core, @maka/storage, @maka/runtime, @maka/runtime-host and the desktop main/preload/renderer build and typecheck clean; biome check on every changed file; check:asf-headers, check:locale-hygiene and check:renderer-architecture pass. No schema change.

Protocol epoch 142 → 143. Two new operations are two new keys in the operation map, and the rule in protocol-compatible-changes/README.md is explicit that a new accepted value moves the epoch whatever the intent. An epoch-142 Host rejects both as unknown, so a Client that offers them must not pair with one.

https://claude.ai/code/session_014ajaRxC4jydavY9nYUFj5J

Diff: 650 lines (+487 / -163) across 8 files Reviewer: M4n5ter Review duration: 1041m
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
0.52
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.388
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5197"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 52% (MEDIUM) · Higher = larger blast radius
52%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 20.5% · Safe to merge
20.5%
Repository