feat(orchestration): preamble hardening + heartbeat detector + ask verb#1391
Closed
feat(orchestration): preamble hardening + heartbeat detector + ask verb#1391
Conversation
- Preamble (#7, #15, #9): worker_done body ("3-sentence summary" + reportPath), BEHAVIOR RULE #1 forbidding AskUserQuestion, heartbeat every 5 minutes with taskId+dispatchId payload, AFTER YOU SEND grace window. - Schema v2 migration: adds 'heartbeat' to messages.type CHECK, adds dispatch_contexts.last_heartbeat_at, gated by user_version PRAGMA with transactional rebuild + explicit CREATE INDEX to avoid silent perf regress. - DB helpers: recordHeartbeat (dispatched-only), getStaleDispatches, getThreadMessagesFor (thread+handle scoped for ask). Co-authored-by: Orca <help@stably.ai>
Handle incoming 'heartbeat' messages by calling recordHeartbeat keyed on payload.dispatchId (strict — log-and-skip if missing, no taskId fallback so a straggler heartbeat from a previously-failed dispatch cannot mask a hung retry per §5.3.4). On every tick after the 10-minute threshold, emit one log per stale dispatched row — no auto-fail. Also threads dispatchId through buildDispatchPreamble so workers can attribute their heartbeats back to the correct dispatch context. Co-authored-by: Orca <help@stably.ai>
Adds a CLI verb that sends a decision_gate message and blocks on the coordinator's reply, scoped to the outbound message's thread. Group addresses (@ALL, @idle, …) are rejected — fan-out questions must use send --type decision_gate explicitly. --json emits bare single-line JSON (bypassing printResult) so workers can pipe `orca orchestration ask … --json | jq -r .answer` without unwrapping an RPC envelope; human mode prints just the answer. On timeout the verb exits 1 and returns {answer: null, timedOut: true}. This is the CLI surface BEHAVIOR RULE #1 in the dispatch preamble points workers at instead of AskUserQuestion. Co-authored-by: Orca <help@stably.ai>
15 tasks
Contributor
Author
|
Superseded by #1403, which bundles this PR with the other three orchestration improvement PRs and resolves the merge conflicts they shared. Branch preserved for diff comparison — not deleting. |
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
ORCHESTRATOR_FEEDBACK.mditems 15, 7, 9orca orchestration askCLI verb (~60 LOC thin wrapper oversend --type decision_gate + check --wait + parse) gives workers a single-command substitute. Thread-scoped wait, group-address reject, bare--jsonbypass of printResult.--body "3-sentence summary"+reportPathin payload example.heartbeatMessageType + preamble BEHAVIOR RULE "send every 5 min" + coordinator-sidelast_heartbeat_atcolumn ondispatch_contexts(schema v2 migration withuser_versiongate, explicitCREATE INDEXpreservation foridx_messages_id/idx_inbox/idx_thread) + 10-min stale-warn in coordinator tick. Heartbeat carriesdispatchId(not justtaskId) for retry-race correctness.Test plan
pnpm typecheckcleanorca orchestration ask --help— verify verb registeredNotes
orca orchestration askverb with thread-scoped wait