Repository navigation
Description
Summary
bb environment cleanup <id> --recover refuses on an ordinary desktop Linux machine because the same-user process guard counts every process it cannot read as a blocker. Such processes are part of every normal login session, so recovery can never pass there, even when nothing is using the workspace.
Error: HTTP 409: Recovery refused: cannot inspect same-user processes (12520, 1535223, 1843, 484728)
Environment
- bb 0.48.1 (protocol 258). The server runs on macOS; the environment is on a remote machine enrolled with the
manualprovider. - Remote machine: Linux Mint 21.3, kernel 6.8.0-138-generic, daemon running as uid 1000.
The processes it couldn't inspect
None of them has anything to do with the workspace:
| PID | Process | Why /proc/<pid>/cwd can't be read |
|---|---|---|
| 12520 | fusermount3 … /run/user/1000/doc (document portal) |
setuid-root binary: real uid is 1000, effective uid is root |
| 1535223 | sshd: user@pts/0 |
sshd per-session process (privilege-separated, not dumpable) |
| 1843 | (sd-pam) |
part of [email protected] and lives for the whole user session |
| 484728 | /usr/bin/ssh-agent -D -a /run/user/1000/keyring/.ssh |
ssh-agent marks itself not dumpable |
readlink /proc/<pid>/cwd returns EACCES for each of these, even for the same user. (sd-pam) runs for as long as the user is logged in (or for good, with lingering), so closing shells doesn't help.
Cause (from the bundled daemon code)
environment.inspect_cleanup walks /proc:
- A process counts as "same-user" when any of its real, effective, saved, or filesystem uids matches the daemon's uid. That includes setuid helpers such as
fusermount3. - For each one it reads
cwdandmaps. Any read error other thanENOENT/ESRCHputs the PID inunreadablePids. - The server then refuses recovery whenever
unreadablePids.length > 0.
On a normal desktop or SSH login that list is never empty, so --recover cannot succeed.
Steps to reproduce
- On a Linux machine with a normal login session (systemd user session, ssh-agent, or an SSH login), get a git-worktree environment into "Needs recovery". In my case a container had written root-owned files into the worktree, so teardown hit
EACCESonunlink. - Remove the cause (I deleted the root-owned files; the worktree now holds only empty directories owned by the user).
- Run
bb environment cleanup <id> --recover.
Expected: recovery goes ahead, because no process has its cwd or a mapped file in the workspace.
Actual: HTTP 409, cannot inspect same-user processes (...). The environment stays in "Needs recovery" with no other way to clear it.
Possible fixes
- Only check a process whose real uid matches the daemon's, so setuid helpers are skipped.
- Treat processes that aren't dumpable (
EACCESoncwd/maps) as not using the workspace, or report them without blocking. - Or add an explicit override after inspection (for example
--recover --ignore-unreadable), since the user has already inspected the workspace.
Two smaller things seen on the same environment
bb environment showreportsTeardown: failed (attempt 46759), though the docs say teardown stops after five failed attempts.- The teardown message nests each time it fails:
Needs recovery: Needs recovery: Needs recovery: EACCES … Inspect the workspace, then run … --recover. Inspect the workspace, then run … --recover. …
Activity
bb-slop-cop commentedon Nov 11, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotworkspaces,host, andconfirmed-repro; no existing classifications were replaced.lanjak commentedon Nov 19, 2026
Hi, thanks for the detailed report. I reproduced this on a Fedora machine with one SSH session, at main e6f3032d18. With nothing in the workspace, recovery is refused for 6 processes:
systemd --user,(sd-pam),sshd-session,gpg-agentand two container processes. All of them run with effective UID 1000, so matching only the real or effective UID would not be enough, as the triage noted.What
/procdoes expose for them is their mount table:mountinfois readable even whencwdis not. #7854 uses that:fusermount3) counts as another user's process, as on macOS since Support environment cleanup recovery on macOS #7520.-v <workspace>:/app -w /appreports its cwd as/app, which main compared with the host path and so did not find.On the two smaller points:
bb environment show <id> --jsonoutput would help.Let environment recovery pass on Linux machines with login sessions (g…
Let environment recovery pass on Linux machines with login sessions (g…