agent-orchestrator/packages/web/server
Ashish Huddar eca3001c80
fix(web): resolve tmux sessions when storageKey is wrapped ({hash}-{projectName}) (#1488)
* fix(web): resolve tmux sessions when storageKey is wrapped ({hash}-{projectName})

ao-core names tmux sessions as `{storageKey}-{sessionId}`, where
storageKey can be either a bare 12-hex hash or the legacy wrapped form
`{hash}-{projectName}`. The resolver only handled the bare-hash form, so
the dashboard terminal never attached for any project whose
storageKey includes the project-name segment (the default on 0.3.0).

Fix (closes #1486): resolve the owning storageKey from disk via
`~/.agent-orchestrator/{storageKey}/sessions/{sessionId}`, then ask tmux
for the exact `{storageKey}-{sessionId}` name via `has-session -t =`.
The on-disk record is authoritative, which avoids ambiguous suffix
matches (e.g. looking up `app-1` must not resolve a distinct session
`{hash}-my-app-1`). If multiple storageKeys own the sessionId (rare,
same-sessionId across projects), each candidate is probed so a stale
metadata dir can't shadow the live session of another project. The
tmux-list-sessions fallback still recovers bare-hash sessions when the
on-disk record is absent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* refactor(web): filter readdir to directories only in tmux resolver

readdirSync without withFileTypes includes plain files, so a stray
file matching STORAGE_KEY_PATTERN (e.g. a backup file named
`aabbccddeef0`) would trigger an unnecessary existsSync probe.
Harmless for correctness but an avoidable syscall per attach.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 00:53:47 +05:30
..
__tests__ fix(web): resolve tmux sessions when storageKey is wrapped ({hash}-{projectName}) (#1488) 2026-04-25 00:53:47 +05:30
direct-terminal-ws.ts fix: add terminal health metrics to /health endpoint 2026-04-09 16:13:44 +00:00
mux-websocket.ts feat(web): enable tmux status bar in web terminal (#1470) 2026-04-22 21:58:52 +05:30
start-all.ts feat(web): single-socket — multiplex terminals + sessions over one WebSocket 2026-04-06 22:46:29 -07:00
terminal-observability.ts chore: rename @composio scope to @aoagents across all packages 2026-04-09 15:59:33 +00:00
tmux-utils.ts fix(web): resolve tmux sessions when storageKey is wrapped ({hash}-{projectName}) (#1488) 2026-04-25 00:53:47 +05:30