GeezerVison is showing github.com — Merge pull request #18 from i2cjak/v2-recovery · BackplaneWorks/Backplane@49bd489
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: LAWS.bend +86Lines changed: 86 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1516,3 +1516,89 @@ law draft_restore_keeps_typing: | 1516 | 1516 | for +t: String | 1517 | 1517 | for +saved: String | 1518 | 1518 | {U.Draft.pick(SCon{c, t}, saved) == SCon{c, t} : String} | | 1519 | + | | 1520 | +# Restarts, stops and waiting asks | | 1521 | +# -------------------------------- | | 1522 | + | | 1523 | +# a stop reaches only a running turn | | 1524 | +law interrupt_idle_nothing: | | 1525 | + for s: M.State | | 1526 | + for now: Nat | | 1527 | + for +client: U32 | | 1528 | + for +id: String | | 1529 | + for thread: String | | 1530 | + {H.Hub.interrupt.k(False{}, s, now, client, id, thread) == H.Step{[], [H.Reply.ok(client, id)]} : H.Step} | | 1531 | + | | 1532 | +# Claude takes the interrupt on its input; a Codex or Grok turn's process | | 1533 | +# is stopped | | 1534 | +law interrupt_claude_input: | | 1535 | + for +th: String | | 1536 | + for +r: String | | 1537 | + {H.Stop.outs("claude", th, r) == [H.AgentSend{th, H.Claude.interrupt(r)}] : List<&2, H.Out>} | | 1538 | + | | 1539 | +law interrupt_codex_stops: | | 1540 | + for +th: String | | 1541 | + for r: String | | 1542 | + {H.Stop.outs("codex", th, r) == [H.AgentStop{th}] : List<&2, H.Out>} | | 1543 | + | | 1544 | +law interrupt_grok_stops: | | 1545 | + for +th: String | | 1546 | + for r: String | | 1547 | + {H.Stop.outs("grok", th, r) == [H.AgentStop{th}] : List<&2, H.Out>} | | 1548 | + | | 1549 | +# what a stopped turn's process still says changes nothing | | 1550 | +law stopped_turn_quiet: | | 1551 | + for s: M.State | | 1552 | + for now: Nat | | 1553 | + for thread: String | | 1554 | + for line: String | | 1555 | + {H.Hub.agent_line.c(False{}, s, now, thread, line) == H.Step{[], []} : H.Step} | | 1556 | + | | 1557 | +# after a restart a turn left running is interrupted, and an open ask is | | 1558 | +# closed, so nothing waits on what died with the old process | | 1559 | +law recover_interrupts_running: | | 1560 | + {H.Hub.running(H.Hub.thread(H.Rec.after(H.Rec.demo(M.Running{}), 10n), "t1")) == False{} : Bool} | | 1561 | + | | 1562 | +law recover_closes_asks: | | 1563 | + {H.Pend.open(M.Asks.all(H.Rec.after(H.Rec.demo(M.Running{}), 10n)), "t1") == 0n : Nat} | | 1564 | + | | 1565 | +# a thread that was not running is left as it was | | 1566 | +law recover_leaves_idle: | | 1567 | + {H.Hub.running(H.Hub.thread(H.Rec.after(H.Rec.demo(M.Completed{}), 10n), "t1")) == False{} : Bool} | | 1568 | + | | 1569 | +law recover_empty_nothing: | | 1570 | + for now: Nat | | 1571 | + {H.Hub.recover(M.State.empty(), now) == H.Step{[], []} : H.Step} | | 1572 | + | | 1573 | +# an open ask makes its thread pending (so it never auto-settles); the | | 1574 | +# answer clears it | | 1575 | +law ask_makes_pending: | | 1576 | + {H.Hub.pending(H.Hub.thread(M.State.replay(H.Pend.fix(M.State.replay(H.Rec.demo.base(), M.State.empty()), [M.AskOpened{"a1", "t1", "approval", "Bash", "ls", "", 3n}]), M.State.replay(H.Rec.demo.base(), M.State.empty())), "t1")) == 1n : Nat} | | 1577 | + | | 1578 | +law answer_clears_pending: | | 1579 | + {H.Hub.pending(H.Hub.thread(M.State.replay(H.Pend.fix(H.Rec.demo(M.Completed{}), [M.AskClosed{"a1", "allow", 4n}]), H.Rec.demo(M.Completed{})), "t1")) == 0n : Nat} | | 1580 | + | | 1581 | +# a parent whose delegated task still works does not settle | | 1582 | +law settle_waits_for_children: | | 1583 | + {H.Kids.busy([M.Task{"k1", "t1", "t2", 1n, M.TaskRunning{}, "", False{}, "codex", ""}], "t1") == True{} : Bool} | | 1584 | + | | 1585 | +law settle_children_done: | | 1586 | + {H.Kids.busy([M.Task{"k1", "t1", "t2", 1n, M.TaskDone{}, "", False{}, "codex", ""}], "t1") == False{} : Bool} | | 1587 | + | | 1588 | +# a turn process's tag names its thread and process; only the process the | | 1589 | +# hub runs for the thread is heard, and an untagged line always is | | 1590 | +law tag_thread: | | 1591 | + {H.Tag.thread(H.Tag.of("t1790175755-9", 4242)) == "t1790175755-9" : String} | | 1592 | + | | 1593 | +law tag_pid: | | 1594 | + {H.Tag.pid(H.Tag.of("t1790175755-9", 4242)) == Some{4242} : Maybe<&2, U32>} | | 1595 | + | | 1596 | +law tag_untagged: | | 1597 | + {H.Tag.pid("t1790175755-9") == None{} : Maybe<&2, U32>} | | 1598 | + | | 1599 | +law tag_old_process_unheard: | | 1600 | + {H.Tag.heard(Some{41}, Some{42}) == False{} : Bool} | | 1601 | + | | 1602 | +law tag_untagged_heard: | | 1603 | + for r: Maybe<&2, U32> | | 1604 | + {H.Tag.heard(None{}, r) == True{} : Bool} |
Collapse file Copy file name to clipboardExpand all lines: PROOF.bend +54Lines changed: 54 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3329,3 +3329,57 @@ def Laws.draft_restore_fills(saved): | 3329 | 3329 |
| 3330 | 3330 | def Laws.draft_restore_keeps_typing(c, t, saved): | 3331 | 3331 | {==} | | 3332 | + | | 3333 | +def Laws.interrupt_idle_nothing(s, now, client, id, thread): | | 3334 | + {==} | | 3335 | + | | 3336 | +def Laws.interrupt_claude_input(th, r): | | 3337 | + {==} | | 3338 | + | | 3339 | +def Laws.interrupt_codex_stops(th, r): | | 3340 | + {==} | | 3341 | + | | 3342 | +def Laws.interrupt_grok_stops(th, r): | | 3343 | + {==} | | 3344 | + | | 3345 | +def Laws.stopped_turn_quiet(s, now, thread, line): | | 3346 | + {==} | | 3347 | + | | 3348 | +def Laws.recover_interrupts_running(): | | 3349 | + {==} | | 3350 | + | | 3351 | +def Laws.recover_closes_asks(): | | 3352 | + {==} | | 3353 | + | | 3354 | +def Laws.recover_leaves_idle(): | | 3355 | + {==} | | 3356 | + | | 3357 | +def Laws.recover_empty_nothing(now): | | 3358 | + {==} | | 3359 | + | | 3360 | +def Laws.ask_makes_pending(): | | 3361 | + {==} | | 3362 | + | | 3363 | +def Laws.answer_clears_pending(): | | 3364 | + {==} | | 3365 | + | | 3366 | +def Laws.settle_waits_for_children(): | | 3367 | + {==} | | 3368 | + | | 3369 | +def Laws.settle_children_done(): | | 3370 | + {==} | | 3371 | + | | 3372 | +def Laws.tag_thread(): | | 3373 | + {==} | | 3374 | + | | 3375 | +def Laws.tag_pid(): | | 3376 | + {==} | | 3377 | + | | 3378 | +def Laws.tag_untagged(): | | 3379 | + {==} | | 3380 | + | | 3381 | +def Laws.tag_old_process_unheard(): | | 3382 | + {==} | | 3383 | + | | 3384 | +def Laws.tag_untagged_heard(r): | | 3385 | + {==} |
Collapse file Copy file name to clipboardExpand all lines: docs/parity.md +2Lines changed: 2 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -15,6 +15,8 @@ Backplane stands. Updated as features land. | 15 | 15 | - **Runtime modes:** runtime modes map to each provider's permissions. Plan mode is supported for Claude and Grok. | 16 | 16 | - **Approvals:** outside full access, Claude and Grok ask through Backplane: Allow / Allow for session / Deny. Grok's ACP `session/request_permission` waits parked for the answer (allow once, allow always, reject); a tool allowed for the session is allowed again at once. AskUserQuestion becomes a question with options. ExitPlanMode becomes a proposed plan with Implement / Dismiss. | 17 | 17 | - **Queued turns:** a message sent while a turn runs is stored on the server and starts when that turn ends. Resends are stored once (`resend_stored_once`). | | 18 | +- **Restarts and stops (orchestrator V2):** a hub that starts from its log ends every turn still marked running as interrupted and closes every open ask, since the process and the parked request died with the old hub; a delegated child's task fails and its parent hears of it (`recover_*`). Queued messages stay held until `queue.resume` or the next message. Stop kills a Codex or Grok turn's process (Claude takes an interrupt on its input); each turn process's output is tagged with its pid, so a stopped one can never end the next turn (`interrupt_*`, `stopped_turn_quiet`, `tag_*`). An open ask makes its thread pending and a running child task keeps its parent from settling (`ask_makes_pending`, `answer_clears_pending`, `settle_waits_for_children`). | | 19 | +- **Drafts:** every keystroke's draft is written at once (native: `<home>/drafts/<thread>`; web: localStorage; phones: preferences) and read back at start, so a crash loses nothing typed (`draft_*`). | 18 | 20 | - **Thread inboxes:** threads message each other through inboxes, and links between threads are shown (`inbox_never_interrupts`). | 19 | 21 | - **Orchestration:** delegate_task, task_status, task_cancel, thread_list, thread_read, thread_send and orchestrator_capabilities over MCP. Delegation is bounded and each result is delivered once (laws). | 20 | 22 | - **Model picker:** per thread, plus a default for new threads. Models are detected from each installed CLI. In the window it opens above the composer at its left edge; every piece's place comes from `src/core/menu.bend`, so however many models and effort levels a CLI reports, rows stack, chips flow onto new lines, names and labels keep their own columns, and the menu never goes above the thread's header (it scrolls instead) nor past the composer's width (laws `menu_*`). A press anywhere off it, or Esc, closes it (`menu_press_*`). The web client draws it as a two-column grid over a shade that closes it. | |
|