Preserve agent settings when sleeping sessions resume (#5916)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Brennan Benson
2026-06-21 16:44:58 -07:00
committed by GitHub
co-authored by Orca
parent a856c7d6b6
commit fe8fe16c83
100 changed files with 3935 additions and 443 deletions
@@ -75,6 +75,7 @@ describe('CommandCodeHookService', () => {
expect(script).toContain('__orca_fill_from_endpoint_file')
expect(script).toContain('[ "$__orca_endpoint_port" != "$ORCA_AGENT_HOOK_PORT" ]')
expect(script).toContain('ORCA_PANE_KEY')
expect(script).toContain('ORCA_AGENT_LAUNCH_TOKEN')
expect(script).toContain('orca-dev/agent-hooks')
expect(script).toContain('endpoint_port=')
}
+3 -1
View File
@@ -105,6 +105,7 @@ function getManagedScript(target: 'local' | 'posix' = 'local'): string {
' ORCA_PANE_KEY) [ -z "${ORCA_PANE_KEY:-}" ] || return 0 ;;',
' ORCA_TAB_ID) [ -z "${ORCA_TAB_ID:-}" ] || return 0 ;;',
' ORCA_WORKTREE_ID) [ -z "${ORCA_WORKTREE_ID:-}" ] || return 0 ;;',
' ORCA_AGENT_LAUNCH_TOKEN) [ -z "${ORCA_AGENT_LAUNCH_TOKEN:-}" ] || return 0 ;;',
' *) return 0 ;;',
' esac',
' __orca_value=$(__orca_read_ancestor_var "$__orca_name") || return 0',
@@ -131,7 +132,7 @@ function getManagedScript(target: 'local' | 'posix' = 'local'): string {
'}',
'# Why: Command Code sanitizes hook subprocess env. The parent TUI process',
'# still has Orca pane/hook metadata, so recover it before posting.',
'for __orca_name in ORCA_AGENT_HOOK_ENDPOINT ORCA_AGENT_HOOK_PORT ORCA_AGENT_HOOK_TOKEN ORCA_AGENT_HOOK_ENV ORCA_AGENT_HOOK_VERSION ORCA_PANE_KEY ORCA_TAB_ID ORCA_WORKTREE_ID; do',
'for __orca_name in ORCA_AGENT_HOOK_ENDPOINT ORCA_AGENT_HOOK_PORT ORCA_AGENT_HOOK_TOKEN ORCA_AGENT_HOOK_ENV ORCA_AGENT_HOOK_VERSION ORCA_PANE_KEY ORCA_TAB_ID ORCA_WORKTREE_ID ORCA_AGENT_LAUNCH_TOKEN; do',
' __orca_fill_from_ancestor "$__orca_name"',
'done',
'if [ -n "$ORCA_AGENT_HOOK_ENDPOINT" ] && [ -r "$ORCA_AGENT_HOOK_ENDPOINT" ]; then',
@@ -170,6 +171,7 @@ function getManagedScript(target: 'local' | 'posix' = 'local'): string {
' -H "X-Orca-Agent-Hook-Token: ${ORCA_AGENT_HOOK_TOKEN}" \\',
' --data-urlencode "paneKey=${ORCA_PANE_KEY}" \\',
' --data-urlencode "tabId=${ORCA_TAB_ID}" \\',
' --data-urlencode "launchToken=${ORCA_AGENT_LAUNCH_TOKEN}" \\',
' --data-urlencode "worktreeId=${ORCA_WORKTREE_ID}" \\',
' --data-urlencode "env=${ORCA_AGENT_HOOK_ENV}" \\',
' --data-urlencode "version=${ORCA_AGENT_HOOK_VERSION}" \\',