Skip to content

fix: give the sandbox a private XDG_RUNTIME_DIR instead of the runner's - #1697

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-1696
Nov 16, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-1696

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

The sandbox inherited the runner's XDG_RUNTIME_DIR=/run/user/1001. That directory is 0700 and owned by runner, so the agent (tend-sandbox, uid 1002) can't open it. The .NET SDK's first run creates a named mutex there, so on a fresh home every dotnet new/build/run failed with Access to the path '/run/user/1001' is denied. The agent environment now sets XDG_RUNTIME_DIR=/home/tend-sandbox/xdg-runtime. prepare_agent_home creates that directory as the sandbox user with mode 0700, the only mode .NET accepts. launch_agent.py doesn't override the name, so the value reaches the session unchanged.

Verification, run in a tend session with .NET on PATH and a fresh home: dotnet new console fails with the inherited value and restores successfully with XDG_RUNTIME_DIR pointing at a mkdir -m 700 directory under /home/tend-sandbox. The home's default ACL still gives the new directory st_mode 0700, since the mask drops to ---. The unit test checks the assignment. proxy/test-setup-sandbox.sh now checks the agent env file, the directory's mode and owner, and the value inside the launched Claude unit.

Closes #1696 — automated triage

The runner's /run/user/1001 is a 0700 directory the sandbox user cannot
open, so tools that create runtime objects there (the .NET SDK's first-run
mutex) failed. The sandbox now gets a 0700 directory it owns.

Closes #1696
@max-sixty
max-sixty merged commit 8142f0c into main Nov 16, 2026
12 checks passed
@max-sixty
max-sixty deleted the fix/issue-1696 branch November 16, 2026 08:31
max-sixty pushed a commit that referenced this pull request Nov 17, 2026
… a green suite (#1703)

Inside a `tend-triage` session, 37 tests in `shared/steps` fail on a
clean checkout. The triage matrix job sets `TEND_ISSUE_NUMBER`, the
sandbox inherits it, and
[`subject_number()`](https://github.com/max-sixty/tend/blob/main/generator/src/tend/runtime/shared/_common.py)
reads it before the event payload. So every test that builds an event
and checks which thread a step acts on gets the session's issue number
instead, e.g. `assert 1696 is None` and `assert 1696 == 851`. This PR
adds an autouse fixture to the root `conftest.py` that removes the
variable before each test. The tests that exercise the matrix path set
it themselves with `monkeypatch.setenv`, so they keep their coverage.

CI never sets the variable, so it stays green either way. The cost is in
triage sessions, which run these suites while repairing an issue.
AGENTS.md tells them that a failure beyond the two network-bound
`test_refresh_consumers.py` tests is real, so every triage run that
touches the runtime either chases 37 false failures or has to work out
for itself that they're spurious. Triage run 43829170062 (#1696 → #1697)
did the second: it reran without its change, saw the same 37, and moved
on.

Verification: with `TEND_ISSUE_NUMBER=1696` set, `pytest shared/steps
proxy` gives 37 failed / 289 passed before the change and 326 passed
after. The full suite with the variable set fails only the two network
tests (those need DNS, which the sandbox doesn't have). The pre-commit
hooks pass on `conftest.py`.

<details><summary>Failing tests before the change, with the variable
set</summary>

| File | Failures |
|---|---|
| `shared/steps/test_common.py` | 7 |
| `shared/steps/test_issue.py` | 12 |
| `shared/steps/test_mark_notification_read.py` | 15 |
| `shared/steps/test_token_usage.py` | 3 |

</details>

Co-authored-by: tend-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 18, 2026
Bumps generator version to 0.3.27 and syncs lockfile.

8 commits since 0.3.26: nightly restarts stalled CI causes and weekly restarts other unfinished issues (#1688), review-runs drains outage trackers the bot closed (#1700), nightly files unfixed reachable defects as issues (#1699), the sandbox gets its own XDG_RUNTIME_DIR (#1697), comment and test fixes (#1701, #1702, #1703), and the 0.3.26 regeneration (#1695).
max-sixty pushed a commit to max-sixty/worktrunk that referenced this pull request Nov 18, 2026
Updates the generated Tend workflows from 0.3.26 to 0.3.27. The workflow
diff only bumps the version pins on `max-sixty/tend/claude` and
`setup-runtime`; the changes below ship in those actions and their
bundled skills
([compare](max-sixty/tend@0.3.26...0.3.27)).

What changes for this repo:

- **Stalled issues get picked up again.** Nightly now runs the open-work
checks that used to live in review-runs. It restarts any open
`tend-ci-cause` issue with no other assignee, no queued or running Tend
run, and no open PR that would close it. Weekly reads the other open
issues where the bot commented last and decides which ones need
follow-up (max-sixty/tend#1688).
- **Nightly files the bugs it doesn't fix.** A reachable defect the
sweep finds but can't fix becomes an issue, or a comment on an existing
one, instead of a line in the step summary (max-sixty/tend#1699).
- **Outage trackers closed by other sessions still get drained.**
Review-runs now marks the trackers it drains, so it still reads the run
rows of a `tend-outage` tracker that a nightly or triage session closed
(max-sixty/tend#1700).
- **The sandbox gets its own `XDG_RUNTIME_DIR`.** It used to inherit the
runner's directory, which the sandbox user can't open
(max-sixty/tend#1697).

Co-authored-by: worktrunk-bot <[email protected]>
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.

Sandbox inherits the runner's XDG_RUNTIME_DIR, which the sandbox user can't open, so the .NET SDK's first run fails

2 participants