cmux-next tests: fake python bridges start without SWIFT_BACKTRACE (base red from #25857)
Fixes the base red from #25857 in cmux-next daemon tests.
#25857 made scripts/cmux-next/swift-test-with-hang-sampler.sh export SWIFT_BACKTRACE=enable=yes,.... On macOS, /usr/bin/python3 is a privileged executable, so with that variable set the Swift runtime writes swift runtime: backtrace-on-crash is not supported for privileged executables. as its first stderr line. DaemonBridge.check reads that line as the fake daemon's answer and fails with "the link dial's answer is not JSON". Nine fake-bridge suites went red on every PR after that: AgentCLIIntentLedger, AgentCLIJobCarrier, AgentCLIProviderRegistration, AgentInventoryWatchConnection, AgentInventoryWatchLifecycle, CreateTerminalLateStart, DaemonSideEventEnvelope, FrontendBrowserTabLateReply and MachineIdentityHandshake.
Change
- A
DaemonBridge.fakePython(_:)test helper in each of the three test targets (CmuxNextDaemonTests,CmuxNextAppTests,CmuxNextAppsTests) starts the fake bridge as/usr/bin/env -u SWIFT_BACKTRACE /usr/bin/python3 -u .... - All 14
DaemonBridge(executable: "/usr/bin/python3", ...)test call sites use it. That covers the 9 failing suites and 5 more that use the same bridge. - Only the fake python child loses the variable. The test process keeps #25857's export, so real crashes still print backtraces.
DaemonBridgeand the sampler script are unchanged.
Homebrew's and Xcode's python3 print the same warning, so switching interpreters doesn't help.
Evidence
- On a fleet Mac (macOS 27.0.1, Xcode 26.6), with #25857's
SWIFT_BACKTRACEvalue set, using AgentCLIIntentLedgerTests' fake-daemon script:- Before (
/usr/bin/python3 -u ...), the first stderr line is the runtime warning, so the check fails. - After (
/usr/bin/env -u SWIFT_BACKTRACE /usr/bin/python3 -u ...), it is{"ok":true}, so the check passes.
- Before (
- On a fleet step at this head, six of the affected suites compile and pass: AgentCLIIntentLedger, MachineIdentityHandshake, DaemonSideEventEnvelope, CreateTerminalLateStart, MachineCatalogConnection and AgentInventoryRefreshConnection.
- Not covered: that step didn't run under the sampler with
SWIFT_BACKTRACEset. This PR's own daemon-tests job is the end-to-end check.
Risk: test-only change.
Agent session: agent session
🤖 Generated with Claude Code
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes the base red from #25857 in cmux-next daemon tests: fake Python bridges now start without SWIFT_BACKTRACE, so the macOS Swift runtime's privileged-executable warning no longer lands on stderr and DaemonBridge.check gets the real dial reply instead of failing with "the link dial's answer is not JSON". Nine fake-bridge suites went red on every PR after #25857, plus five more that use the same bridge.
Changes
- Adds a
DaemonBridge.fakePython(_:)helper in each of the three test targets (CmuxNextDaemonTests,CmuxNextAppTests,CmuxNextAppsTests) that starts the fake bridge as/usr/bin/env -u SWIFT_BACKTRACE /usr/bin/python3 -u .... - All 14
DaemonBridge(executable: "/usr/bin/python3", ...)call sites now use the helper. - Only the fake Python child loses the variable; the test process keeps #25857's export, so real crashes still print backtraces.
DaemonBridgeand the sampler script are unchanged; this is a test-only change.