Skip to content

feat: add window_title to shpool list --json - #441

Merged
ethanpailes merged 1 commit into
shell-pool:masterfrom
GeoffChurch:session-titles
Oct 28, 2026
Merged

ethanpailes merged 1 commit into
shell-pool:masterfrom
GeoffChurch:session-titles

Conversation

@GeoffChurch

Copy link
Copy Markdown
Contributor

Issue Link

Discussion #440

AI Policy Ack

ack

Drafted with vibes, edited and tested with meat

This PR was:

  • mostly or completely vibe coded
  • mostly or completely meat coded
  • bit of both

Description

Adds window_title to the output of shpool list --json:

{
  "sessions": [
    {
      "name": "djt-miner",
      "started_at_unix_ms": 1790885744638,
      "last_connected_at_unix_ms": 1791385820043,
      "last_disconnected_at_unix_ms": 1791383990390,
      "status": "Disconnected",
      "shell_pid": 51725,
      "attachments": [],
      "window_title": "Coins mined: 23.203 ($0.00032). Level: patriot"
    }
  ]
}

The use case is letting downstream tools show the user the window titles of their sessions. Many processes (shells, coding assistants, etc) send status information to the window title, which is traditionally visible in a terminal window/tab but in shpool is inaccessible without attaching to the session.

This change exposes the current title through shpool list --json without attaching.

@GeoffChurch
GeoffChurch force-pushed the session-titles branch 2 times, most recently from d52638e to 4baf484 Compare October 7, 2026 17:31
@ethanpailes

ethanpailes commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

I think you'll need to pull in shpool-vterm 0.2.7 (shell-pool/shpool-vterm#12)

Comment thread Cargo.toml Resolved

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

I'd like to take a different approach to avoid double-storing the same data.

Comment thread libshpool/src/daemon/server.rs Resolved
Comment thread libshpool/src/daemon/shell.rs Resolved
Comment thread libshpool/src/daemon/shell.rs Resolved
@ethanpailes

Copy link
Copy Markdown
Contributor

I just bumped the shpool-vterm version to 0.2.8, so you should be able to rebase and impl

Comment thread libshpool/src/daemon/server.rs Resolved
Comment thread libshpool/src/daemon/shell.rs Outdated
fn handle_fetch_metadata(
spool: &dyn session_restore::SessionSpool,
request: Result<MetadataRequest, crossbeam_channel::RecvError>,
requests: &mut crossbeam_channel::Receiver<MetadataRequest>,

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.

Draining other incoming requests immediately seems overly complicated. Let's just handled one at a time and use the top level dispatch loops for all incoming requests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Or, maybe we could at least continue; after shell.rs:541 (like maybe_switch does on shell.rs:523), which would let it handle bursts without the hacky inner loop. Burstiness is the typical case in my workflow since I have k running instances of the TUI app, and they all call shpool list --json at the same time to refresh their view whenever the events channel sends anything.

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.

I still the see the requests chan being passed in, which is confusing. It looks like it is only being used to hang up on error. Let's instead accept a hang_up closure or just bubble up the error and have the caller handle it. Right now you have to read the implementation to see that we are only handling one request because the args still hint at more being handled.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done - 6d374b1 lifts the handling to the caller.

Re adding a continue; to reduce latency in case of bursts, is that fine?

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.

I'm not sure what you mean about adding continue. I don't see one in that patch. I'd rather not overcomplicate it. Let's just handle one request per loop until we observe a problem with that approach.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That was in reference to my comment from earlier in the thread.

I didn't include the continue in the patch, but I was asking because, given my workflow with K TUI app instances, each event on the events channel triggers K shpool list --json calls, which will lead to titles being omitted whenever the 500ms RPC timeout is exceeded (each request takes ~50-60ms and the timeout is 500ms, so I can only scale to K≈10)

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.

Oh, I see, you're saying add a continue after handle_fetch_metadata. Yeah that seems fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done (a028fe7). Thank you🙏

@ethanpailes

Copy link
Copy Markdown
Contributor

Looks like you have fmt issues.

@GeoffChurch

Copy link
Copy Markdown
Contributor Author

Looks like you have fmt issues.

Done (ded4fce) - my nightly toolchain was old.

@ethanpailes

Copy link
Copy Markdown
Contributor

fmt is still broken, can you fix that?

@GeoffChurch

GeoffChurch commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

fmt is still broken, can you fix that?

Done (1128b16). These comments were already on master so the CI runner probably just updated its rustfmt

@ethanpailes

Copy link
Copy Markdown
Contributor

FYI: for this project, with very rare exceptions PRs should be 1-1 with commits, so please just edit your commit in place rather than making a chain I'll need to manually squash.

Looks like fmt is still broken. You probably need to make sure you are matching your fmt to the one running in CI, which you can figure out from the CI config files. You may want to run rustup update nightly or something like that.

@GeoffChurch

Copy link
Copy Markdown
Contributor Author

FYI: for this project, with very rare exceptions PRs should be 1-1 with commits, so please just edit your commit in place rather than making a chain I'll need to manually squash.

Looks like fmt is still broken. You probably need to make sure you are matching your fmt to the one running in CI, which you can figure out from the CI config files. You may want to run rustup update nightly or something like that.

Okay, I squashed the commits. The CI failed on config_watcher::test::debounce, which looks like it's just flaky since it failed after comment changes.

@ethanpailes
ethanpailes merged commit 6927985 into shell-pool:master Oct 28, 2026
12 checks passed
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.

2 participants