agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

bug(desktop): staged tmux is never refreshed — existsSync check keyed on app version pins the daemon to an outdated binary

Open axisrow opened this issue 3 months ago • 2 comments

Summary

ensureBundledTmuxStaged copies the packaged tmux into ~/.ao/runtime/tmux/<appVersion>-<platform>-<arch>/tmux and skips the copy when that path already exists. It never compares the staged binary with the bundled one, and the directory identity is the app version. So when a build changes the bundled tmux without bumping the app version, the daemon keeps launching the previously staged binary forever — the new tmux is packaged, verified by the postPackage gate, installed, and then never used.

Analyzed against: 2aeba22c0

Where

frontend/src/main.ts, ensureBundledTmuxStaged:

if (existsSync(destination)) {
  stagedBundledTmuxBinary = destination;
  return;
}

stableBundledTmuxBinaryPath (frontend/src/shared/bundled-tmux.ts) derives the directory from ${appVersion}-${platform}-${arch}, so an unchanged app version means an unchanged destination path.

Why it matters

tmux's client/server protocol is not compatible across versions, so which tmux binary the daemon runs decides which running tmux servers it can talk to at all. A stale staged binary is not a cosmetic mismatch: after #4293 moved AO onto its private socket, every probe against a server started by a different tmux fails with server exited unexpectedly, the reaper logs liveness probe inconclusive, and the terminal pane loops on Terminal disconnected — reattaching….

Observed on macOS arm64: the packaged app shipped one tmux version, the daemon kept executing an older one staged under the same app version, and the mismatch only became visible as terminal panes that never reattached. Deleting ~/.ao/runtime/tmux/<identity>/ and relaunching fixed it immediately.

Steps to reproduce

  1. Launch a packaged build so tmux is staged under ~/.ao/runtime/tmux/<appVersion>-<platform>-<arch>/tmux.
  2. Build and install another package that changes the bundled tmux version without changing the app version.
  3. Relaunch and inspect the daemon's AO_TMUX_BINARY, then run that binary with -V.
  4. It reports the old version; the newly bundled binary is never staged.

Expected

A staged binary that no longer matches the bundled one is replaced. Any of these would do:

  • include a content hash of the bundled binary in the staged directory identity;
  • compare source/destination (size + hash, or mtime) and re-stage on mismatch;
  • run the staged binary's -V and re-stage when it disagrees with the bundled version, reusing the constant the postPackage gate already verifies against.

The dev-build case is the same class: app.getVersion() is stable across local rebuilds, so anyone iterating on the tmux bundle hits it every time.

Impact

Silent and hard to attribute: the package is correct, the gate passes, the install succeeds, and the only symptom is terminals that never reattach — with nothing in the UI pointing at a stale staged binary.

axisrow avatar Aug 25 '26 10:08 axisrow

Thanks for contributing to Agent Orchestrator.

This issue is being picked up by the current external contributor on-call pair:

  • @illegalcall
  • @somewherelostt

If someone is already working on this, please continue as usual. The on-call pair is added for visibility, tracking, and support, not to take over the work. If you need help with review, direction, reproduction, or next steps, please tag @illegalcall and @somewherelostt here.

For faster context or live questions, you can also join the AO Discord.

Join the session here: https://discord.gg/H6ZDcUXmq

Come by if you want to see what is being built, ask questions, or just hang around with the community.

somewherelostt avatar Aug 25 '26 15:08 somewherelostt

@diyaavirmani — could you take this Mac-reproduced issue? GitHub currently won’t let me formally assign your account on this repo. I’m removing my assignment to flag this handoff request, but the issue will not list you as assignee unless repo access changes.

codebanditssss avatar Sep 24 '26 06:09 codebanditssss