fix(authority): fence async execution ownership - #89
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Two updated error paths can return misleading messages due to validation ordering and broadened attach failure causes, which should be corrected to match the new authority fencing behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR hardens authority boundaries around asynchronous workflow/orchestration operations by fencing mutations to the correct session/runtime context and by requiring exact workflow execution identity for transitions and monitor attachment.
Changes:
- Require workflow transitions to include the current execution identity (state/seq/revision/execution id) to prevent delayed/stale callers from settling reissued work.
- Fence orchestration creation/cancellation/expiry paths to the initiating store + actor + generation, and treat malformed spawn “success” as uncertain.
- Require monitor attachment to match workflow definition/execution identity and to be owned by the current execution lease.
File summaries
| File | Description |
|---|---|
| test/workflow-admission.test.ts | Updates transition calls to include current workflow identity. |
| test/store.test.ts | Updates workflow transition + monitor attachment tests for identity/lease requirements. |
| test/scheduler.test.ts | Updates scheduler-driven transition/monitor tests to pass identity. |
| test/orchestration-tools.test.ts | Adds regression test for provider probe completing after session rebinding. |
| test/orchestration-runtime.test.ts | Adds fencing tests for delayed cancellation and malformed spawn replies. |
| test/monitor-tools.test.ts | Adds test that a foreign runtime cannot attach a monitor under another lease; updates helper wiring. |
| test/loop-command.test.ts | Updates transition calls to pass current workflow identity. |
| test/helpers/workflow-identity.ts | Adds helpers to capture current workflow/monitor attachment identity from a store entry. |
| test/astra-identity-store.test.ts | Adds file-backed regressions for monitor attachment and transition CAS after reissue. |
| src/tools/workflow-tools.ts | Makes workflow transition identity parameter required in the store-like interface. |
| src/tools/subagent-orchestration-tools.ts | Fences orchestration creation across async provider probing by store/actor/generation. |
| src/tools/monitor-tools.ts | Passes expanded identity + actor into workflow monitor attachment. |
| src/store.ts | Enforces identity checks for transitions; enforces identity + lease ownership for monitor attachment. |
| src/runtime/subagent-orchestration-runtime.ts | Adds fencing for delayed cancellation/expiry and classifies malformed spawn success as uncertain. |
| src/index.ts | Exposes workflow actor (session/runtime) to monitor tools. |
Review details
Suppressed comments (1)
src/tools/monitor-tools.ts:138
attachWorkflowMonitorcan now fail due to lease/identity fencing (not just because the workflow changed). The current error text and summary incorrectly attribute all failures to workflow changes, which can mislead users when the real cause is missing/foreign lease ownership.
if (!attached) {
void getMonitorManager().stop(entry.id);
return Promise.resolve(textResult(`Monitor #${entry.id} stopped because workflow #${workflow.id} changed before ownership could be attached.`, {
kind: "monitor", action: "create", tone: "error", summary: `Workflow #${workflow.id} changed`, expanded: [],
}));
- Files reviewed: 15/15 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
trvon
force-pushed
the
fix/execution-identity-authority
branch
from
September 5, 2026 02:19
0bc7425 to
bfcf093
Compare
trvon
force-pushed
the
fix/execution-identity-authority
branch
from
September 5, 2026 02:51
bfcf093 to
5671a8c
Compare
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
Validation
Stack
2 of 6. Base:
fix/lock-publication-authority.