Skip to content

feat(acp-bridge): list sessions under their Paseo project directory - #189

Merged
tee8z merged 1 commit into
tee8z/bridge-usagefrom
tee8z/bridge-session-projects
Nov 13, 2026
Merged

tee8z merged 1 commit into
tee8z/bridge-usagefrom
tee8z/bridge-session-projects

Conversation

@tee8z

@tee8z tee8z commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Application stack block#197: #179 → #182 → #187 → #191 → #180 → #186 → #189 → #188 → #194 → #196. Merge from the bottom upward.

Problem

After a Paseo daemon pod is replaced, $HOME (an emptyDir) is gone and Paseo shows "No sessions for this host". The conversations still exist as Buzz threads, and the bridge's session/list returns them. But every entry had "cwd":"/" and the bridge ignored Paseo's cwd filter. Paseo requires a session's working directory to exist (assertUsableWorkingDirectory) and groups sessions by project path, so restored conversations had no project and no usable directory.

This is Phase 1 of fix B2 in the Paseo fix plan: the bridge part of "History and file paths do not survive". It does not include transcript replay or path rewriting.

Change

Project tag (session/new). When the client's cwd is one of the following, the thread root that the bridge creates records ["paseo-project","<owner>/<repo>"]:

  • $HOME/code/<owner>/<repo>
  • $HOME/code/<owner>/<repo>@<branch>
  • a subdirectory of either

The path is normalised lexically. The owner must be 1 to 39 ASCII letters, digits, -, or _, and must not start with -. The repository must be 1 to 100 ASCII letters, digits, ., -, or _, and must not be . or ... Any other cwd records nothing.

Tag trust. The bridge uses the tag only on a root that the owner or the bridge's own signer authored (the same authors(scope) set that session aliases use). It ignores the tag on roots by other channel members.

Loaded sessions (session/load). A loaded thread takes its project from a trusted, valid root tag. When the root has none, the session takes the project of the client's cwd. In both cases, /fresh tags the new root.

Listed cwd (session/list).

Root Listed cwd
Exactly one valid paseo-project tag, authored by the owner or the signer, and $HOME/code/<owner>/<repo> exists $HOME/code/<owner>/<repo>
Any other root (no tag, malformed tag, two tags, a tag by another member, or the project directory is missing) $HOME/buzz, created with mode 0700 when missing
As above, when $HOME/buzz cannot be created $HOME

cwd filter. The filter is mapped the same way, and the bridge keeps only sessions whose listed cwd is equal to it:

  • A project path, its @branch view, or a subdirectory of either selects the project directory.
  • $HOME/buzz or a subdirectory of it selects $HOME/buzz.
  • Any other absolute path must match exactly. A relative path matches nothing.

Sessions that the filter excludes still advance the cursor. The paging rules are unchanged: a page can be short or empty and still return nextCursor.

Ended sessions (follow-up to #187). The ended notice and the /recover command no longer say that recovery needs the Buzz app. The notice quotes the manager's own reason, and the offered commands depend on that reason:

Manager notice Offered
Invites a mention in this thread (session_ended, session_ending, recovery_interrupted, recovery_mode_conflict in #187) /recover and /fresh
Says the checkpoint cannot be restored (no_checkpoint), or only points to a new thread (for example, a manager without #187) /fresh only

/recover resends the message in the thread. The text says that this mentions the agent again so that its manager can try to restore the session. It does not promise a restore. The bridge still accepts a typed /recover when it is not offered. The bridge still matches the manager's prefix This thread's agent session ended.

Scope gains home (from dirs::home_dir(), or / when there is none), so tests can use a temporary home.

Merge and deploy order

The recovery wording assumes that #187's sandbox manager is deployed before this bridge reaches the daemon image, or in the same rollout. With an older manager, the notice ("Recover it from desktop, or mention me in a new thread.") does not invite a mention in the thread, so the bridge offers only /fresh. A typed /recover still works after a recovery in the Buzz app.

Validation

  • cargo fmt --all: clean.
  • cargo clippy -p buzz-cli --all-targets -- -D warnings: clean.
  • cargo test -p buzz-cli: 554 passed.
  • Not run locally: cargo clippy -p buzz-cli --all-targets --target x86_64-pc-windows-msvc. The target is not installed. The only unix-only API in the new tests (PermissionsExt) is now under #[cfg(unix)]. CI's Windows Rust job runs this clippy.

New and changed tests. They drive the production bridge loop over in-memory stdio with the relay fake and a temporary HOME:

  • history_tests::sessions_list_under_their_recorded_project_directory:
    • session/new in …/code/block/buzz@feat/x/src tags the root block/buzz. session/new in /tmp/elsewhere and in $HOME adds no tag.
    • Listing covers six roots: tagged with an existing directory, untagged, tagged with a missing directory, ../etc (with $HOME/etc present), two tags, and a root by another member tagged with the existing project. The first lists under its project directory, and the other five list under $HOME/buzz. On unix, $HOME/buzz is created with mode 0700.
    • Filter table: the project path, a trailing /, @main, a subdirectory, and a .. path select the project. $HOME/buzz and $HOME/buzz/notes select the fallback roots. The missing project path, another project, $HOME, and a relative path select nothing.
    • After a bridge restart, three loaded threads each get the no_checkpoint notice. The notice is quoted, only fresh is advertised, and /recover is not mentioned. Then /fresh: the tagged root (loaded with cwd $HOME) keeps block/buzz; the untagged root (loaded in …@main) takes block/buzz; the member's tagged root (loaded in /tmp/elsewhere) gets no tag.
  • history_tests::sessions_list_under_home_when_the_buzz_directory_cannot_be_created: $HOME/buzz is a file, so the session lists under $HOME. The filter $HOME includes it, and the filter $HOME/buzz excludes it.
  • tests::ended_notices_offer_recover_only_when_a_mention_here_may_restore: one row per feat(manager): recover ended threads from owner and gateway mentions #187 notice, plus the pre-feat(manager): recover ended threads from owner and gateway mentions #187 notice and the bare prefix.
  • tests::acp_session_drives_a_remote_agent_through_the_relay: with feat(manager): recover ended threads from owner and gateway mentions #187's session_ended notice, the bridge quotes it, offers recover and fresh, and says the manager "can try to restore the session", not that it restores the checkpoint.
  • projects::tests: two tables, one for mapping cwd to a project and one for GitHub name rules.

Mutation checks. Each mutation was applied, the named test failed, and the mutation was reverted:

Mutation Failing tests
Filter ignored both sessions_list_* tests
No project tag on new roots sessions_list_under_their_recorded_project_directory
Loaded session drops its project sessions_list_under_their_recorded_project_directory (the /fresh step)
valid_project not checked on root tags sessions_list_under_their_recorded_project_directory (../etc lists as $HOME/code/../etc)
Root author not checked when listing sessions_list_under_their_recorded_project_directory
Root author not checked when loading sessions_list_under_their_recorded_project_directory (member /fresh tagged)
Untagged load does not take the client's project sessions_list_under_their_recorded_project_directory (untagged /fresh untagged)
/recover always offered ended_notices_offer_*, sessions_list_under_their_recorded_project_directory
/recover never offered ended_notices_offer_*, acp_session_drives_a_remote_agent_through_the_relay

Not verified

Summary by CodeRabbit

  • New Features
    • ACP sessions now retain project context from eligible working directories, helping sessions resume and appear under the correct project.
    • Session recovery options reflect the sandbox manager’s notice: /recover is offered when the notice indicates mention-based recovery may work, while /fresh starts a new session and workspace.
  • Bug Fixes
    • Session history listing now supports working-directory filters and reports session directories more accurately. Nonmatching sessions may still advance pagination, resulting in shorter or empty pages.

Current revision

The Unix-only directory mode now uses a scoped mutable builder. This fixes Windows Clippy without weakening owner-only directory creation. The session-project and fallback tests passed. The complete downstream CLI test suite also passed before splitting the replay layers.

Opened for review with scoped validation; current CI and live staging checks are tracked separately.

Combined stack check

The current combined source passed CLI (569), SDK (359), manager (166), and Kubernetes backend (226) library tests, executable tests, and scoped Clippy. The full just ci attempt passed workspace Rust lint and stopped at missing desktop gio-2.0 dependencies. Live staging checks remain for rollout.

Loading
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