8000 fix(minimald): run daemon tasks in the session working-directory layout by gominimal-aw-bot[bot] · Pull Request #1910 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimald): run daemon tasks in the session working-directory layout - #1910

Merged
norrietaylor merged 2 commits into
mainfrom
inbox-patch/task-run-session-cwd-eb325230288f41cb
Oct 4, 2026
Merged

norrietaylor merged 2 commits into
mainfrom
inbox-patch/task-run-session-cwd-eb325230288f41cb

Conversation

@gominimal-aw-bot
@gominimal-aw-bot gominimal-aw-bot Bot commented Oct 3, 2026 •
Copy link
Copy Markdown
Contributor

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABU1JnKg

Summary

min task run and the in-box min run path built their sandbox with the
bound-directory layout, so a task's working directory was the daemon's
internal tree path and PWD leaked it. This routes both through the session
layout instead, mounting the tree at /workbench and home at /home —
matching what the interactive session sees.

Changes

  • Add a WdLayout choice to mctx::env::EnvArgs (BoundDir default,
    Session { home, working }) and branch Env::build on it via a single
    apply_wd_layout helper.
  • Thread wd_layout through make_env (forwards BoundDir) and
    make_env_with_network (new parameter).
  • task_producer (exec.rs) and the in-box min run path (env.rs) request
    WdLayout::Session from the session's home/working paths.
  • mip run and the remaining callers keep the bound-directory default.

Behavior notes

  • Patches still apply. WdSetup::Session now carries fs_mappings;
    sandbox2 validates them (a missing read-only source is still an error, a
    read-write one is still created), creates their targets and mounts them
    after the /home and /workbench binds, so a read-only mapping inside the
    read-write session home stays read-only. mctx retargets a mapping inside the
    session home or tree to the matching path under /home or /workbench;
    any other absolute path (e.g. /var/run/docker.sock) keeps its own path.
  • Environment changes for daemon-run tasks. The session layout brings the
    session's command_env: LANG=C.UTF-8 with no LC_ALL;
    XDG_CONFIG_HOME/XDG_DATA_HOME/XDG_STATE_HOME move from the
    state_key-backed /state/home, /state/data, /state/state into the
    shared session home (/home/.config, /home/.local/share,
    /home/.local/state); PATH gains /home/.local/bin; PS1 and SHELL
    are set. state_key still backs XDG_CACHE_HOME (/state/cache).
    Documented in docs/reference/tasks.md. mip run is unchanged.

Verification

  • cargo build --workspace --locked — passes
  • cargo fmt --all --check — passes
  • cargo test -p mctx --locked — 31 passed, 3 ignored (includes new
    wd_layout_selects_session_or_bound_dir test)
  • cargo clippy --workspace --locked -- -D warnings — blocked by 3
    pre-existing needless_borrows_for_generic_args errors in
    crates/args/src/lib.rs (unrelated to this change)
  • cargo test --workspace --locked — blocked by pre-existing failures in
    crates/checkouts (git clone environment) and crates/minimald (network
    namespace tests), unrelated to this change

live-session: native-daemon-e2e — runs on this PR; not ru 8000 nnable in the fixer sandbox

`min task run` and the in-box `min run` path built their sandbox with
the bound-directory layout, so the task's working directory was the
daemon's internal tree path and `PWD` leaked it. Route both through the
session layout instead, mounting the tree at `/workbench` and home at
`/home`, matching what the interactive session sees.

Add a `WdLayout` choice to `mctx::env::EnvArgs` and thread it through
`make_env`/`make_env_with_network`. `task_producer` and the in-box run
path request `WdLayout::Session`; `mip run` and the other callers keep
the bound-directory default.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gominimal-aw-bot
gominimal-aw-bot Bot requested a review from a team as a code owner October 3, 2026 21:44
@gominimal-aw-bot gominimal-aw-bot Bot added the agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. label Oct 3, 2026
@gominimal-aw-bot
Copy link
Copy Markdown
Contributor Author

[inbox-patch:clobber]

This PR would revert recently merged work

Simulating this merge shows it undoing commits that landed on the base branch within the last 3 day(s):

  • 291024eb0 — 85% of its 7 surviving lines in these files would be undone
    • T47 — Place each host-address box in its own classifier leaf and keep it there (T47 — Place each host-address box in its own classifier leaf and keep it there #1768)
      This is the stale-read failure, not a conflict: the agent read these files before the commits above merged, then wrote the whole region back from that stale read. Git applies it cleanly, so there is no conflict, no failing test, and nothing unusual in the diff summary — see gominimal/inbox#460.

Before merging, restore the reverted region to its state on the base branch. The rest of this PR is unaffected.

If a listed commit is one this PR intends to supersede, say so and merge — this check reports, it does not block.

@coderabbitai
coderabbitai Bot commented Oct 3, 2026 •
Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: f8efb77e-8bdc-43b3-8b82-5d566402bfbe
📥 Commits

Reviewing files that changed from the base of the PR and between 83f09fb and 94284c6.

📒 Files selected for processing (4)
  • crates/mctx/src/env.rs
  • crates/mctx/src/lib.rs
  • crates/minimald/src/env.rs
  • crates/minimald/src/exec.rs

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.


📝 Walkthrough

Walkthrough

Environment construction now supports bound-directory and session layouts. Session task callers pass the session home and working paths when creating an environment.

Changes

Session Working-Directory Layout

Layer / File(s) Summary
Layout configuration
crates/mctx/src/env.rs
WdLayout defines bound-directory and session options. Env::build applies the selected layout. Tests assert the resulting paths for both options.
Environment API wiring
crates/mctx/src/lib.rs
The public API exports and accepts WdLayout, and forwards it to Env::build. make_env selects the bound-directory layout.
Session task callers
crates/minimald/src/env.rs, crates/minimald/src/exec.rs
Task setup passes the session home and working paths when creating an environment.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant TaskSetup as minimald task setup
  participant Context as Context::make_env_with_network
  participant Env as Env::build
  participant Sandbox as sandbox configuration
  TaskSetup->>Context: Pass WdLayout::Session with home and working paths
  Context->>Env: Forward WdLayout through EnvArgs
  Env->>Sandbox: Configure session directories
Loading

Suggested reviewers: 0chroma

Merge Risk: ⚪ Minimal · up to 94284

The task paths match the intended session layout, and no actionable merge-blocking issue remains after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the main change: routing daemon tasks through the session working-directory layout. It is concise and uses a Conventional Commit-style subject.
Description check ✅ Passed The description explains the change, behavior, and verification results. The “Verification” section provides the testing information required by the template, but the explicit Checklist section is mis…
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit hops through paths anew
/workbench joins /home in view
Bound directories keep their place
Session paths meet the sandbox space
Soft paws stamp the layout true

Comment @coderabbitai help to get the list of available commands.

@gominimal-aw-bot gominimal-aw-bot Bot added the agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch label Oct 3, 2026
@norrietaylor norrietaylor changed the title fix: run daemon tasks in the session working-directory layout fix(minimald): run daemon tasks in the session working-directory layout Oct 4, 2026
A daemon-run task now uses the session layout, which dropped the task's
patch mappings: read-only patches became writable through the read-write
home, missing sources went unreported, and absolute paths vanished.

WdSetup::Session now carries fs_mappings. sandbox2 validates, creates
targets for and mounts them after the /home and /workbench binds, and
mctx retargets a mapping inside the session home or tree under /home or
/workbench. Document the layout's environment in the tasks reference.
@norrietaylor
Copy link
Copy Markdown
Member

/review

@minimal-foundry
minimal-foundry Bot commented Oct 4, 2026 •
Copy link
Copy Markdown
Contributor

Approved: no findings at 59d9ed536d0a.

Nothing to do.

Clobber: none: git log on crates/mctx/src/env.rs and crates/sandbox2/src/config.rs shows this PR's two commits (94284c65, 59d9ed53) atop an unrelated main, with no recent fix reverted. The BoundDir target-creation moved from inside the WdSetup::BoundDir arm to a shared loop over fs_mappings() — behavior preserved for BoundDir (Isolated returns &[]), and only that plus the new Session m…

@minimal-foundry minimal-foundry Bot 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.

minimal-review — approved

Verdict APPROVE — No findings.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Oct 4, 2026
@norrietaylor
norrietaylor added this pull request to the merge queue Oct 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 4, 2026
@norrietaylor
norrietaylor added this pull request to the merge queue Oct 4, 2026
Merged via the queue into main with commit 55ae592 Oct 4, 2026
35 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/task-run-session-cwd-eb325230288f41cb branch October 4, 2026 19:17
Sign up for free to join this conversation on GitHub. 7D90 Already have an account? Sign in to comment

Labels

agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch clobber-suspected review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0