mirror of
https://github.com/stablyai/orca.git
synced 2026-10-22 16:03:47 +00:00
fix(terminal): preserve user-enabled functrace traps
This commit is contained in:
@@ -200,7 +200,7 @@
|
||||
"command": "pnpm exec vitest run --config config/vitest.config.ts src/main/daemon/repro-13767-shell-ready-marker-lost-to-exec.test.ts src/main/providers/local-pty-shell-ready.test.ts src/relay/pty-shell-launch.test.ts",
|
||||
"result": "passed",
|
||||
"durationSeconds": 4.65,
|
||||
"summary": "All 107 focused local, daemon, and relay assertions passed, including real zsh/bash exec restoration, command modifiers, ZDOTDIR expansion ordering, and DEBUG trap invocation preservation."
|
||||
"summary": "All 107 focused local, daemon, and relay assertions passed, including real zsh/bash exec restoration, command modifiers, ZDOTDIR expansion ordering, and DEBUG trap invocation preservation when the user enables functrace during startup."
|
||||
}
|
||||
],
|
||||
"runtimeBudget": {
|
||||
@@ -213,7 +213,7 @@
|
||||
},
|
||||
"redGreenEvidence": {
|
||||
"status": "complete",
|
||||
"evidence": "PR head 05c0ac91dd1 failed the exact exec \"$ZDOTDIR/zsh-replacement\" oracle with status 127 after expanding the target inside Orca's wrapper directory. The just-in-time shim candidate passed that oracle plus all 107 focused assertions; the existing #13767 red/green evidence independently proves the original replacement-shell readiness failure."
|
||||
"evidence": "PR head 05c0ac91dd1 failed the exact exec \"$ZDOTDIR/zsh-replacement\" oracle with status 127 after expanding the target inside Orca's wrapper directory. The just-in-time shim candidate passed that oracle plus all 107 focused assertions. The pre-fix Bash guard reported USER_DEBUG_NESTED=0 after a profile enabled functrace; the reviewed guard reports USER_DEBUG_NESTED=1 while keeping the ordinary non-functrace trap unmultiplied. The existing #13767 red/green evidence independently proves the original replacement-shell readiness failure."
|
||||
},
|
||||
"performanceBudget": {
|
||||
"required": true,
|
||||
|
||||
@@ -156,7 +156,8 @@ _orca_exec_command_check_body="$(declare -f __orca_startup_command_is_exec)"
|
||||
__orca_preserve_startup_exec() {
|
||||
local _orca_exec_command="$BASH_COMMAND"
|
||||
if [[ -n "\${_orca_exec_startup_chained_debug_trap:-}" ]] &&
|
||||
{ [[ "\${_orca_exec_functrace_was_set:-0}" == "1" ]] || (( \${#FUNCNAME[@]} <= 1 )); }; then
|
||||
{ [[ "\${_orca_exec_functrace_was_set:-0}" == "1" ||
|
||||
"\${_orca_exec_user_enabled_functrace:-0}" == "1" ]] || (( \${#FUNCNAME[@]} <= 1 )); }; then
|
||||
eval "$_orca_exec_startup_chained_debug_trap" || true
|
||||
fi
|
||||
case "$_orca_exec_command" in
|
||||
|
||||
@@ -641,17 +641,23 @@ describePosix('local PTY shell-ready launch config', () => {
|
||||
expect(output).toContain('CHILD_TEMP_PC=unset')
|
||||
})
|
||||
|
||||
itWithBash('preserves functrace enabled by a user profile', async () => {
|
||||
itWithBash('preserves user-enabled functrace and nested DEBUG trap behavior', async () => {
|
||||
const { getBashShellReadyRcfileContent } = await importFreshLocalPtyShellReady()
|
||||
writeFileSync(join(userDataPath, '.bash_profile'), 'set -T\n')
|
||||
writeFileSync(
|
||||
join(userDataPath, '.bash_profile'),
|
||||
'set -T\nprofile_nested() { :; }\nprofile_nested\nprintf "USER_DEBUG_NESTED=%s\\n" "${USER_DEBUG_NESTED:-0}"\n'
|
||||
)
|
||||
const wrapper = `trap '[[ " \${FUNCNAME[*]} " != *" profile_nested "* ]] || USER_DEBUG_NESTED=1' DEBUG
|
||||
${getBashShellReadyRcfileContent()}`
|
||||
|
||||
const output = runInteractiveBashRcfile(
|
||||
getBashShellReadyRcfileContent(),
|
||||
wrapper,
|
||||
userDataPath,
|
||||
"shopt -qo functrace && printf 'USER_FUNCTRACE_ON\\n'\nexit 0\n"
|
||||
)
|
||||
|
||||
expect(output).toContain('USER_FUNCTRACE_ON')
|
||||
expect(output).toContain('USER_DEBUG_NESTED=1')
|
||||
})
|
||||
|
||||
itWithBash('does not multiply a pre-existing DEBUG trap inside startup functions', async () => {
|
||||
|
||||
Reference in New Issue
Block a user