mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 16:03:49 +00:00
Both reported failures now have end-to-end coverage against a real Docker
OpenSSH relay, gated on ORCA_E2E_SSH_DOCKER like the rest of the suite.
- ssh-reconnect-pane-cardinality-across-partitions: three real reconnect cycles;
after each, pane ids unchanged, exactly one live lease per leaf, exactly one
remote shell per pane key, and exactly one pty id bound per leaf ACROSS BOTH
durable partitions. Two partitions agreeing is tolerated; two naming different
shells is the S4 divergence and fails. PASSES.
- ssh-reattach-does-not-resume-agent-twice: the host itself records one line per
shell launch via a .bashrc hook keyed by ORCA_PANE_KEY, so a duplicate resume
is counted at the source rather than inferred. Fault is SIGSTOP on the
detached relay. PASSES.
- ssh-disconnected-pane-affordance: written whole but held as test.fixme. The
banner needs the target CONNECTED while a single pane's attach fails, and both
host-side faults drove the target out of connected instead. Held rather than
deleted so it runs the day a seam exists; the reason is measured, not assumed.
New helpers: docker-ssh-relay-stall (SIGSTOP/SIGCONT, reads the stop back off
/proc so a fault that did not land cannot make an oracle vacuous), and
remote-pane-launch-transcript.
Note for whoever picks these up: a stalled relay leaves two detached relay groups
on the host, and readDockerSshRelayProcessSnapshot throws on more than one, so
call it before the fault.
Writing these is what surfaced RC2 surviving S3 — fixed in 7cd7fef927.
69 lines
2.8 KiB
TypeScript
69 lines
2.8 KiB
TypeScript
/**
|
|
* A stand-in for an agent's transcript, recorded by the host rather than by the app.
|
|
*
|
|
* The STA-3077 report's second failure is "a coding agent was resumed twice into
|
|
* one transcript". Driving a real coding agent inside the Docker OpenSSH fixture
|
|
* is not possible — no agent binary ships in the image and no provider session
|
|
* exists to resume — so the observable is moved to the thing that actually goes
|
|
* wrong: a second shell launching for a pane that already has one. Every shell
|
|
* the relay starts for a pane appends one line here, keyed by pane, so "resumed
|
|
* twice" reads as two lines for one pane key and needs no app-side reporting to
|
|
* be believed.
|
|
*
|
|
* The hook is installed before the first pane exists, and each test asserts the
|
|
* first launch was recorded before asserting no second one was — a hook that
|
|
* silently failed to fire would otherwise make every clause pass vacuously.
|
|
*/
|
|
import {
|
|
execDockerSshRelayTargetCommand,
|
|
type DockerSshRelayTarget
|
|
} from './docker-ssh-relay-target'
|
|
|
|
const TRANSCRIPT_PATH = '/tmp/orca-pane-launch-transcript.log'
|
|
|
|
// Prepended, not appended: Debian's stock /root/.bashrc returns early for a
|
|
// non-interactive shell, and a hook placed after that guard would only fire
|
|
// sometimes. `ORCA_PANE_KEY` is injected by the pane launch path alone, so a
|
|
// `docker exec` probe shell adds nothing.
|
|
const INSTALL_TRANSCRIPT_HOOK_COMMAND = `
|
|
set -e
|
|
hook=/root/.orca-pane-launch-transcript.sh
|
|
cat > "$hook" <<'HOOK'
|
|
if [ -n "$ORCA_PANE_KEY" ]; then
|
|
printf '%s\\t%s\\n' "$ORCA_PANE_KEY" "$$" >> ${TRANSCRIPT_PATH}
|
|
fi
|
|
HOOK
|
|
touch /root/.bashrc ${TRANSCRIPT_PATH}
|
|
if ! grep -q orca-pane-launch-transcript /root/.bashrc; then
|
|
printf '. %s\\n' "$hook" | cat - /root/.bashrc > /root/.bashrc.next
|
|
mv /root/.bashrc.next /root/.bashrc
|
|
fi
|
|
grep -c orca-pane-launch-transcript /root/.bashrc
|
|
`
|
|
|
|
export function installRemotePaneLaunchTranscript(target: DockerSshRelayTarget): void {
|
|
const installed = Number(
|
|
execDockerSshRelayTargetCommand(target, INSTALL_TRANSCRIPT_HOOK_COMMAND).split('\n').pop()
|
|
)
|
|
if (installed !== 1) {
|
|
throw new Error(`The pane launch transcript hook was not installed exactly once: ${installed}`)
|
|
}
|
|
}
|
|
|
|
/** Every shell launch the host recorded, oldest first, as `paneKey\tpid`. */
|
|
export function readRemotePaneLaunchTranscript(target: DockerSshRelayTarget): string[] {
|
|
return execDockerSshRelayTargetCommand(target, `cat ${TRANSCRIPT_PATH} 2>/dev/null || true`)
|
|
.split('\n')
|
|
.filter((line) => line.includes('\t'))
|
|
}
|
|
|
|
/** The pids the host launched a shell for under one pane key. */
|
|
export function readRemotePaneLaunchPids(
|
|
target: DockerSshRelayTarget,
|
|
paneKey: string
|
|
): number[] {
|
|
return readRemotePaneLaunchTranscript(target)
|
|
.filter((line) => line.split('\t')[0] === paneKey)
|
|
.map((line) => Number(line.split('\t')[1]))
|
|
}
|