Skip to content

fix: add attach error status mode - #401

Draft
hyang214 wants to merge 1 commit into
shell-pool:masterfrom
hyang214:agent/attach-error-status-mode
Draft

fix: add attach error status mode#401
hyang214 wants to merge 1 commit into
shell-pool:masterfrom
hyang214:agent/attach-error-status-mode

Conversation

@hyang214

Copy link
Copy Markdown

Summary

  • add --error-status-mode shell|attach to shpool attach
  • preserve the current shell-status behavior by default
  • let automation opt into a non-zero status when attach fails, including busy-session and invalid-name failures
  • return success after a successful attach in attach mode even when the attached shell exits non-zero

Root cause

shpool attach currently returns success when a session is busy, so callers cannot distinguish a successful attach from the already has a terminal attached path. The existing shell-status behavior also means the eventual shell exit code answers a different question from whether attach itself succeeded.

The new mode keeps the existing behavior compatible while giving scripts and wrappers an explicit attach-status contract.

Closes #153.

Validation

  • cargo +1.85.0 check --workspace
  • cargo +1.85.0 test --all-features --test attach (55 passed, 9 platform-specific tests ignored)
  • cargo +nightly fmt -- --check
  • cargo +nightly clippy --all-targets --all-features -- -D warnings -A mismatched-lifetime-syntaxes (allows the existing warning in test_hooks.rs)

AI usage

AI assistance was used to inspect the codebase, draft the implementation and tests, and prepare this PR description. I reviewed the resulting diff and ran the validation commands above locally.

@google-cla

google-cla Bot commented Jul 17, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ethanpailes ethanpailes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks mergable as is. Thanks!

Let's see if CI is happy.

@ethanpailes

Copy link
Copy Markdown
Contributor

Looks like we'll need a CLA sig before we can merge.

@ethanpailes

Copy link
Copy Markdown
Contributor

Oh, one nit: this is a feature not a bugfix.

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.

FR: shpool should have a flag to disable threading exit status back

2 participants