feat: report attachments in shpool list --json#379
Open
GeoffChurch wants to merge 4 commits into
Open
Conversation
ethanpailes
reviewed
Jun 8, 2026
ethanpailes
left a comment
Contributor
There was a problem hiding this comment.
This looks pretty good, just a few comments, no major refactor asks.
Contributor
|
I squeezed out a release on you again so you'll need to rebase. |
a73d7c0 to
5ce84e6
Compare
This patch adds a per-session `attachments` list to `shpool list --json`. Each attachment reports the session name template the client attached with (e.g. `{workspace}-edit`) and the pid of its `shpool attach` process, so external tools can e.g. show how attachments would be affected by a `shpool var set`, or offer to SIGKILL an attach process.
Currently, a session has at most one attachment, but it is reported as a list in case shpool later supports multiple attachments (shell-pool#40).
Leaves room for e.g. `Attachment::start_cmd_template` by not using a broad name like `Attachment::template`
5ce84e6 to
19103b1
Compare
The attachment is maintained/read in lockstep with the timestamps, so it can live in the same struct behind the same lock. Rename `SessionLifecycleTimestamps` to `SessionLifecycleState` since it now holds more than timestamps. Encapsulate the lock as a private field in a new `SessionLifecycle` type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue Link
Discussion #378
AI Policy Ack
Please ack that you have read the AI Policy
and explain your use of AI to generate this PR.
ack
I vibe coded the initial draft, and then iterated on that with both meats and vibes.
This PR was:
Description
In the
shpool list --jsonoutput, add anattachmentsfield to each session with each attachment's originaltemplatestring (e.g."{workspace}-edit"or"htop") and its attach procpid. Currently, a session has at most one attachment, but it's provided here as a list in case #40 comes to fruition.For example,
$ shpool list --json { "sessions": [ { "name": "myproj-edit", "status": "Attached", "attachments": [ { "template": "{workspace}-edit", "pid": 1234 } ], ... }, { "name": "myproj-term", "status": "Disconnected", "attachments": [], ... }, { "name": "htop", "status": "Attached", "attachments": [ { "template": "htop", "pid": 4321 } ], ... } ] }External tools can then check or signal the attach proc using the
pidfield, and relate variables (fromshpool var list) to sessions and attachments using thetemplatefield (e.g. a TUI could preview which attachments would respond to a proposed variable change).Note that, while
attachmentsis a list in the JSON output, in the code it's anOption(not aVec), to avoid the footgun of e.g. assuming a prematureVecwill always be of length <= 1. An eventual #40-like change would force an explicit, self-contained migration toVecto pass typechecking. There might even be an argument in favor of making it a nullable field in the JSON, instead of a list.