Files
kandev/apps/backend
José Almeida 2e2bd441c6 fix(passthrough): apply profile cli_flags to passthrough command (#722)
* fix(passthrough): apply profile cli_flags to passthrough command

PassthroughOptions had no CLIFlagTokens field, so the passthrough
launch path silently dropped profile-configured cli_flags. Mirror the
ACP launch path: resolve via cliflags.Resolve and append the tokens
through StandardPassthrough.BuildPassthroughCommand.

Fixes #718.

* fix(passthrough): skip auto-restart on fast-fail launch errors

A bad CLI flag, missing binary, or auth failure makes the agent
process exit immediately. The auto-restart loop then thrashed
forever, spamming "[Agent exited. Restarting...]" without ever
recovering.

Track the start time of each passthrough process and short-circuit
the restart path when an exit lands within 2s with a non-zero code.
Surface a one-shot terminal banner pointing the user at the likely
fix instead.

* refactor(passthrough): snapshot start time at call site to avoid race

Claude review on PR #722: handlePassthroughExit ran in a goroutine and
read execution.PassthroughStartedAt while the next launch could
concurrently write it. Snapshot the value synchronously in
handlePassthroughStatus and thread it through; isFastFailExit now
takes the start time directly.

Also extracts attemptPassthroughRestart and notifyFastFailExit to
keep handlePassthroughExit under the funlen limit.

* refactor(passthrough): measure fast-fail uptime from status timestamp

Claude review on PR #722: handlePassthroughExit's uptime measurement
folded in the cleanupDelay sleep (~100 ms), so the logged duration was
systematically inflated and a process that died at, say, 1.95 s would
slip past the 2 s cutoff.

Use status.Timestamp (set when the child actually exited) as the exit
time and pass it through to isFastFailExit. notifyFastFailExit now
receives a pre-computed uptime so the log reflects real child runtime.
2026-04-28 00:08:42 +01:00
..