← Back to Pull requests

fix(engine): declared paths are fixed for the role: pinned with their sources; a symbolic link is the declaration it implies, approved by the user link by link; sources read only after their links are checked #401

Closed
unknown closed this pull request without merging on Nov 16, 2026 15:32 UTC
View on GitHub
unknown unknown commented on Nov 14, 2026 07:47 UTC
Author

Part of #389. A declaration's access governs what is inside its path, not the path itself: the role cannot rename, remove or replace a declared path, so it cannot choose which host path a later launch binds.

What was possible before (each measured on main)

  • The roles Supervisor ran mv .asb .asb.moved; its read-only purpose files were then writable at the old path.

  • A rename above an own path uncovered the host's original.

  • With ~/store/ = read-write and ./x/d/ = read-write outside:~/store/real/ (also copy, copy-on-write), the role replaced ~/store/real by a link to an undeclared ~/secret; the next launch bound ~/secret.

  • Under shared, the role renamed ~/.claude/CLAUDE.md away and put a link to ~/secret/g there; the next launch on an account bound that file read-write.

  • A launch that was refused because of such a link had already copied through it into the role's store, and a later launch showed the content.
  • The rule

  • Fixed paths. For every declaration and channel, in every mode (read-write included): the path, the directories on the way to it that the role has read-write from the host, its source, and the directories on the way to the source wherever a read-write host mount shows them, are mount points (each bound onto itself), so a rename or removal fails with EBUSY. A source counts in the modes that read or bind it. A directory on the way that the host does not have yet is made where and as bwrap would make it, and is fixed at the first launch already.

  • Links. A symbolic link P -> T on the way of a declared path or a source, or inside a directory bound plainly from the host, is the declaration it implies: P = MODE outside:T, where MODE is what P has without the link. Where it would hand the role a host object outside its view, the user approves it: each such link is asked about on its own, apart from the dot-file, at a terminal (asb --trust, or a launch there), and refused without one, naming asb --trust. The approval is recorded per project with the links on the way, the target and the mode, and every launch resolves the path again against it. A changed link on a declared or channel path asks again (refused without a terminal); a changed link that only the review's scan found is left unbound until the next review, and blocks nothing. The question names the declaration that skips it when written in the dot-file. A link to what the role already sees, with any access, implies nothing: the role reaches the target with the access the target has. A declaration written for such a path keeps its mount, at the target's own path with the declaration's mode. An implied declaration passes the refusals a written outside: passes (a secret store, the engine's own directories, ~). bwrap cannot mount on a link, so the mount goes to T's own path (a link in a host directory stays) or covers the link (in a directory of the engine's).

  • Reads. The engine reads, copies, hashes or creates something at a source only through one check (_as_src_guard), once what the links on the way to that source imply is in view or approved: at a launch on that launch's view, at a join against the keeper's view and the approvals. What is bound or read afterwards is the resolved target the check saw, not the link's path. A refused launch has read nothing through the link.

  • The way out is in the briefing: the role asks the user to rename, move or remove on the host and, where needed, update the dot-file and relaunch.

  • --preset native is unchanged: nothing is pinned, checked or refused there.
  • What changes for users and roles

  • A rename, hard link or git mv across a fixed directory's boundary fails with "Invalid cross-device link" (mv and cp copy instead); a single-file source reached through a read-write directory view is written in place, not replaced by a temp-file rename. Under shared this now includes the claude profile's CLAUDE.md, settings.json and skills/.

  • A linked CLAUDE.md, skills/ or cache/ in ~/.claude (dotfiles such as CLAUDE.md -> ../dot/claude/CLAUDE.md), links in the project and links on declared paths work. A launch without a terminal refuses once and names asb --trust; the review asks about each link as the declaration it implies; once approved it is read with that mode. On main the same link was unreadable under shared and failed with "bwrap: Can't mount on symlink destination" under the other presets.

  • Refused, each with a message that invites a feature request: a linked settings.json, plugins, agents, projects, rules, commands or ~/.claude.json (of ~/.claude only CLAUDE.md, skills/ and cache/ may be links), a project whose .agent-sandbox is a link, and a hide through a link. A linked ~/.claude itself is refused too, naming CLAUDE_CONFIG_DIR for a base that lives elsewhere. Of these, main launched with a linked ~/.claude.json and a linked ~/.claude.

  • The role also sees a link's target at the target's own path. In a directory it has read-write from the host it can replace the link; the next launch then asks again, or for a link the scan found, the next review.

  • Links inside the project and other plainly bound directories are picked up at asb --trust, not at a launch.

  • asb --reset of a copy channel discards the copy; the next launch copies the source again (it used to copy at once).

  • Pinned in the shipped models: .asb and .asb/roles for the roles Supervisor and setup role, the github setup role and the market role; under the claude profile ~/.claude/cache.
  • Also fixed

  • A copy-on-write channel with a source elsewhere (the profile's relocation, or outside:) read through its own path instead of the source; it now reads the source, as copy does. This is on main too.
  • Not in this PR

  • Links inside copy, seed-only and copy-on-write sources, which are read through (on main too); the next PR.

  • The window between the engine's checks and bwrap's mounts (--bind-fd, now possible with bubblewrap 0.12).
  • Cost

    Launch time of a plain shared launch, median of 9 alternated runs: 1794 ms on main, 2097 ms here. No find at an ordinary launch; the scan for links inside bound directories runs only in the review (asb --trust, --check, --roles).

    Tests

    tests/unit/ro-pins.bats and tests/integration/ro-pins.bats (new, real bwrap): every mode on the key and the source side, each refusal, each refusal hint followed to a working launch, a refused launch leaving the host as it was. tests/integration/native-parity.bats: copy, seed-only and copy-on-write under native. tests/integration/profile-claude/accounts.bats: the two-launch shapes with an account. tests/integration/profile-claude/links.bats (new): the dotfiles link under each preset and with an account, a link planted by a role refused without a terminal and asked at one, a retargeted link or a changed mode asked again, an approved link resolved again at every launch (a second role changing a directory on its way gets nothing bound), a link to a read-only path the role sees giving no write, a link to a secret store refused, each refused location, a join against a link made since its launch.

    ---
    _🤖 Drafted by Claude Code (an AI agent) and reviewed & approved by pearu._

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: pearu Review duration: 3345m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.57 · 650 lines diff across 8 files
    0.57
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #401"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 57% (MEDIUM) · Higher = larger blast radius
    57%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%