Skip to content

Fix/tmux isalive agent exited 2802#2831

Open
ApexYash11 wants to merge 2 commits into
AgentWrapper:mainfrom
ApexYash11:fix/tmux-isalive-agent-exited-2802
Open

Fix/tmux isalive agent exited 2802#2831
ApexYash11 wants to merge 2 commits into
AgentWrapper:mainfrom
ApexYash11:fix/tmux-isalive-agent-exited-2802

Conversation

@ApexYash11

Copy link
Copy Markdown

Summary

Fixes #2802 by ensuring tmux.IsAlive() correctly detects when an agent has exited, even if the tmux pane remains open.

Previously, liveness checks only verified that the tmux session existed. Since the keep-alive shell leaves the pane running after the agent exits, completed agents were incorrectly reported as still alive.

With this change, the runtime sets a pane-scoped @ao_agent_exited option when the agent exits. IsAlive() now checks this marker after has-session and reports the correct agent state while remaining backward compatible if the option is unavailable.

Implementation

  • Added a helper to build the show-options command for @ao_agent_exited.
  • Updated the launch command to set @ao_agent_exited=1 before starting the keep-alive shell.
  • Updated IsAlive() to check the exit marker after has-session.
  • Preserved backward compatibility by treating missing or unsupported options as alive.

Testing

Added and updated tests covering:

  • show-options command generation.
  • Launch command includes the exit marker.
  • IsAlive() reports exited agents correctly.
  • Fallback behavior when show-options fails.

Verified with:

  • go test ./internal/adapters/runtime/tmux/...
  • go vet ./...

… IsAlive

Set @ao_agent_exited pane option before entering the keep-alive shell in
buildLaunchCommand, then query it in IsAlive after has-session succeeds.
When the option is "1" the agent has exited even though the pane and
session survive, so IsAlive returns false (dead). Any read error (option
unset, transient failure) falls back to true (alive) - backward-compatible.

Fixes AgentWrapper#2802
@somewherelostt

Copy link
Copy Markdown
Collaborator

Thanks for contributing to Agent Orchestrator.

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

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 @neversettle17-101 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(runtime/tmux): IsAlive reports pane-exists as agent-alive, masking crashed agents behind the keep-alive shell

3 participants