Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions skill-guides/orchestration.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ assignment does not prove its agent stopped.

`ORCA skills get orchestration --reference references/<file>.md`

| Situation | Reference |
| ---------------------------------------------- | ----------------------------------------- |
| Task DAGs, several Runs | `references/coordinator-loop.md` |
| Child worktrees, SSH, WSL, a connected server | `references/placement-and-remote.md` |
| Group messages | `references/messaging-and-gates.md` |
| A failed or unknown worker; retry, stop, reset | `references/recovery-and-cleanup.md` |
| Custom argv or terminal layout | `references/low-level-topology.md` |
| Legacy labels, adopted Runs, takeover | `references/legacy-contract-migration.md` |
| Situation | Reference |
| --------------------------------------------------- | ----------------------------------------- |
| Task DAGs, several Runs | `references/coordinator-loop.md` |
| Child worktrees, SSH, WSL, a connected server | `references/placement-and-remote.md` |
| Group messages | `references/messaging-and-gates.md` |
| Failed worker; retry, stop, reset; coordinator gone | `references/recovery-and-cleanup.md` |
| Custom argv or terminal layout | `references/low-level-topology.md` |
| Legacy labels, adopted Runs, takeover | `references/legacy-contract-migration.md` |
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

Follow a legacy label's printed command exactly, with the same executable.

Only if the original coordinator is gone or cannot prove ownership, take over
from your own terminal:
This applies only to the Run Orca adopted automatically from the legacy
contract. For any other Run whose coordinator is gone, use plain `run-use`
([Recovery and cleanup](recovery-and-cleanup.md#coordinator-gone)).

Only if the adopted Run's original coordinator is gone or cannot prove
ownership, take over from your own terminal:

```text
ORCA orchestration run-use --id <adopted_run_id> --takeover-legacy
Expand Down
14 changes: 14 additions & 0 deletions skill-guides/orchestration/references/recovery-and-cleanup.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ stopped; check `worker-show` before acting again.
`orchestration reset` deletes coordination state; run it only when the user
gives that state up.

## Coordinator gone

If the Run's coordinator has exited and the user asks you to continue its Run,
bind it to your own terminal, then read its state:

```text
ORCA orchestration run-use --id <run_id>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
ORCA orchestration check --run <run_id>
Comment thread
Jinwoo-H marked this conversation as resolved.
Resolved
```

Never take a Run from a coordinator that is still active. `--takeover-legacy`
is only for the automatically adopted legacy Run; see
[Legacy contract migration](legacy-contract-migration.md).

## User-directed recovery after the breaker

After three failed starts in one `--retry-of` chain, the Dispatch circuit-breaks
Expand Down
38 changes: 28 additions & 10 deletions src/cli/bundled-skill-guides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3912,14 +3912,14 @@ const ORCHESTRATION_MARKDOWN = [
"",
"`ORCA skills get orchestration --reference references/<file>.md`",
"",
"| Situation | Reference |",
"| ---------------------------------------------- | ----------------------------------------- |",
"| Task DAGs, several Runs | `references/coordinator-loop.md` |",
"| Child worktrees, SSH, WSL, a connected server | `references/placement-and-remote.md` |",
"| Group messages | `references/messaging-and-gates.md` |",
"| A failed or unknown worker; retry, stop, reset | `references/recovery-and-cleanup.md` |",
"| Custom argv or terminal layout | `references/low-level-topology.md` |",
"| Legacy labels, adopted Runs, takeover | `references/legacy-contract-migration.md` |",
"| Situation | Reference |",
"| --------------------------------------------------- | ----------------------------------------- |",
"| Task DAGs, several Runs | `references/coordinator-loop.md` |",
"| Child worktrees, SSH, WSL, a connected server | `references/placement-and-remote.md` |",
"| Group messages | `references/messaging-and-gates.md` |",
"| Failed worker; retry, stop, reset; coordinator gone | `references/recovery-and-cleanup.md` |",
"| Custom argv or terminal layout | `references/low-level-topology.md` |",
"| Legacy labels, adopted Runs, takeover | `references/legacy-contract-migration.md` |",
"",
].join('\n')

Expand Down Expand Up @@ -3955,8 +3955,12 @@ const ORCHESTRATION_LEGACY_CONTRACT_MIGRATION_REFERENCE_MARKDOWN = [
"",
"Follow a legacy label's printed command exactly, with the same executable.",
"",
"Only if the original coordinator is gone or cannot prove ownership, take over",
"from your own terminal:",
"This applies only to the Run Orca adopted automatically from the legacy",
"contract. For any other Run whose coordinator is gone, use plain `run-use`",
"([Recovery and cleanup](recovery-and-cleanup.md#coordinator-gone)).",
"",
"Only if the adopted Run's original coordinator is gone or cannot prove",
"ownership, take over from your own terminal:",
"",
"```text",
"ORCA orchestration run-use --id <adopted_run_id> --takeover-legacy",
Expand Down Expand Up @@ -4049,6 +4053,20 @@ const ORCHESTRATION_RECOVERY_AND_CLEANUP_REFERENCE_MARKDOWN = [
"`orchestration reset` deletes coordination state; run it only when the user",
"gives that state up.",
"",
"## Coordinator gone",
"",
"If the Run's coordinator has exited and the user asks you to continue its Run,",
"bind it to your own terminal, then read its state:",
"",
"```text",
"ORCA orchestration run-use --id <run_id>",
"ORCA orchestration check --run <run_id>",
"```",
"",
"Never take a Run from a coordinator that is still active. `--takeover-legacy`",
"is only for the automatically adopted legacy Run; see",
"[Legacy contract migration](legacy-contract-migration.md).",
"",
"## User-directed recovery after the breaker",
"",
"After three failed starts in one `--retry-of` chain, the Dispatch circuit-breaks",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { openExistingStructuredSession } from '@/lib/open-existing-structured-session'
import { structuredSessionWorkspaceMissingMessage } from '@/lib/activate-ai-vault-structured-session'
import { ALL_TUI_AGENTS } from '../../../../shared/agent-launch/catalog/tui-agent-display-names'
import { isStructuredAgentSessionIdFor } from '../../../../shared/agent-session/structured-agent-session-create'
import type { AutomationRun } from '../../../../shared/automations-types'
Expand Down Expand Up @@ -218,7 +219,7 @@ async function openRunChat(
revealWorkspace(workspace)
}
} else if (result.kind === 'failed' && result.failure.reason === 'workspace-missing') {
toast.error(workspaceUnavailableMessage())
toast.error(structuredSessionWorkspaceMissingMessage(result.failure))
} else if (outcome !== 'activated') {
runChatUnavailable()
}
Expand Down
27 changes: 16 additions & 11 deletions src/renderer/src/lib/activate-ai-vault-structured-session.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { AiVaultSession } from '../../../shared/ai-vault-types'
import type {
StructuredSessionOpenFailure,
StructuredSessionOpenSource,
StructuredSessionOpenResult,
StructuredSessionOpenDeps
Expand Down Expand Up @@ -110,17 +111,7 @@ function presentDesktopStructuredSession(
} else if (result.kind === 'failed') {
const agent = source.kind === 'sender' ? (source.displayName ?? '') : (source.agent ?? '')
if (result.failure.reason === 'workspace-missing') {
toast.error(
result.failure.workspaceKind === 'folder'
? translate(
'auto.lib.activateAiVaultStructuredSession.folderWorkspaceRemoved',
'The folder workspace was removed.'
)
: translate(
'auto.lib.activateAiVaultStructuredSession.worktreeDeleted',
'The worktree was deleted.'
)
)
toast.error(structuredSessionWorkspaceMissingMessage(result.failure))
} else if (result.failure.reason === 'gone') {
if (result.failure.surface === 'terminal') {
const terminalGone = deps.terminalGone ?? showAgentPaneUnavailable
Expand All @@ -135,3 +126,17 @@ function presentDesktopStructuredSession(
}
}
}

export function structuredSessionWorkspaceMissingMessage(
failure: Pick<StructuredSessionOpenFailure, 'workspaceKind'>
): string {
return failure.workspaceKind === 'folder'
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
? translate(
'auto.lib.activateAiVaultStructuredSession.folderWorkspaceRemoved',
'The folder workspace was removed.'
)
: translate(
'auto.lib.activateAiVaultStructuredSession.worktreeDeleted',
'The worktree was deleted.'
)
}
Loading