Repository navigation
fix: harden orchestration lifecycle messages - #8388
Draft
Dirtywater97 wants to merge 1 commit into
Draft
Dirtywater97 wants to merge 1 commit into
Dirtywater97 wants to merge 1 commit into
Conversation
This branch has not been deployed
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
worker_donedelivery idempotent and prevent older dispatch completions from re-entering the coordinator inbox.task-update --result-filesupport and teach agents to use PowerShell-safe structured lifecycle flags.Root cause: the orchestration skill demonstrated a raw JSON payload command that PowerShell could quote-strip. The runtime accepted that lifecycle message too late in the flow, leaving the worker task unreconciled and allowing malformed or repeated completions into the audit stream.
User impact: Windows orchestration workers can now report lifecycle state with structured flags, malformed completions fail without state or inbox mutation, and safe retries do not duplicate coordinator mail.
Screenshots
No visual change.
Testing
pnpm lint(targeted oxlint and the max-lines ratchet passed)pnpm typecheck(typecheck:nodeandtypecheck:clipassed; web was not affected)pnpm test(focused suite passed: 5 files, 167 tests)pnpm buildAdditional validation:
quick_validate.py.git diff --checkand the repository pre-commit lint/format hook passed.AI Review Report
Two independent read-only AI reviews were run. The first found no blocker and flagged stale/duplicate completion handling plus missing end-to-end
--result-filecoverage; both findings were fixed and retested. The follow-up review verified latest-dispatch enforcement, retry idempotency, PowerShell result paths, and the focused test evidence, with no blocker remaining.Cross-platform review explicitly considered macOS, Linux, and Windows. The changed runtime validation uses platform-neutral TypeScript/Node behavior. Windows PowerShell shell quoting and file paths are exercised end to end. No keyboard shortcuts, UI labels, renderer behavior, or Electron-specific platform behavior changed.
Security Audit
Review covered lifecycle payload parsing, RPC/IPC input validation, sender/task/dispatch authority, stale-message rejection, duplicate delivery, explicit result-file path handling, and failure atomicity. Malformed input is rejected before message insertion or task mutation. No dependencies, credentials, secrets, authentication behavior, or command execution were added.
Follow-up: a direct RPC client can still address an otherwise valid lifecycle message to the wrong concrete coordinator handle because dispatch rows do not persist coordinator identity. Fully binding recipient authority requires a dispatch-schema migration and is intentionally deferred from this no-migration fix.
Notes
This PR adds no database migration. Existing dispatch storage remains compatible.
ELI5
Orchestration lifecycle messages could be malformed, unauthorized, or stale and still change task state, and PowerShell quoting could break structured flags. Messages are validated first, repeated worker_done is idempotent, and agents get safer PowerShell-friendly lifecycle flags.