Repository navigation
Conversation
) An omitted `out` was documented — tool description and the shared SKILL.md — as writing the starter spec beside the target. The default write allowlist is the server's cwd plus $AGENTDESCENT_HOME, so for the user's file outside both roots the shortest documented path was refused: measured at 5048349 with both variables unset, `algorithm_spec(gepa, …)` returned `ok=false`, "out '…/user-project/agentdescent.gepa.spec.json' is outside the operator's write allowlist". The default now goes under $AGENTDESCENT_HOME when the operator allows it (else the first allowed root), an empty allowlist says there is no default instead of naming a directory, and a refused explicit `out` names the allowed roots plus an `out` that works. The explicit-`out` check itself is unchanged (#1018). The description and SKILL.md say where the default lands; the rendered host trees are regenerated from the package.
|
Reviewed tip:
A review on this sha is what this comment asks for; it is not a verdict and it is not a merge. |
HugoXK
left a comment
There was a problem hiding this comment.
Review tip: f1677e9
Verdict: PASS — no must-fix items.
This is an internal AgentDescent Security review. It is not the PASS that .github/agent/review-policy.json counts — that file lists only login Birfy — and it is not the merge gate or an approval of the merge; the tip still needs the reviewer's PASS and the owner's click.
Read at the exact head f1677e9 in a fresh clone (single commit, base 5048349a, 8 files +211/−17).
- The renamed row retires a bug-pinning assertion; it does not delete a reachable refusal.
tests/test_mcp_algorithm_spec_allowlist.py:42-55now asserts the omitted-outcall succeeds withspec_path == allowed/agentdescent.rrsi.spec.jsonand nothing written beside the target. The old assertion could only hold because the default path itself was outside the allowlist — the bug being fixed. The security property it observed (an implicit write stays inside the operator's allowlist) is now asserted positively, and a default outside the allowlist is unreachable by construction:mcp.py:558-565chooses the default fromallow(surface_common.py:226-246) andmcp.py:574-576still routes the result through_check_write. The explicit-outrows are untouched (:27-40,:58-70). - Only the default path is widened; the explicit-
outrefusal is behaviourally identical to#1018.mcp.py:567still resolves the caller's path andmcp.py:574-576still checks it; the refusal condition insurface_common.py:353-361is unchanged from base and only the message gained the roots and the example (surface_common.py:362-364,mcp.py:579-585). Probed at head:outoutside the allowlist →ok False, no file; empty allowlist →ok Falsewith "no write directory is allowed";outinside a root still plans. No caller-supplied path bypasses the check. - The
test (3.11)flake does not intersect this diff. It istests/test_sandbox.py::test_a_recycled_pid_does_not_keep_a_dead_run_alive_forever,tests/test_sandbox.py:369: the lease is set totime.time() - 0.3withttl=0.2, so the one-grace window closes 0.1 s after the assertion begins; a slow CI step flipsreap()0 → 1. Same lease data, no delay →reap() == 0; +0.15 s →reap() == 1(deterministic probe at this tip), and 15 local repeats pass.tests/test_sandbox.pyimports evolution/filetree/runners/policies/metrics/sandbox, andagentdescent/sandbox.pyimports neithermcpnorsurface_common; the diff touches neither file. Unresolved flake, not this PR's failure path, not a must-fix here — it deserves its own card.
Reproduction and gates: base 5048349a with only the new test file → 6 failed, matching the body; head → 17 passed for the new file plus the allowlist and algorithm_spec files; the six allowlist-message CLI files → 40 passed; the skill-render integration rows pass, the package skill body is embedded exactly in the Claude Code tree and in the DSH plugin, and gen_api_docs --check is up to date with 50 changelog fragments OK; the checks at this head are 9 success with deploy skipped.
Non-blocking observations, not must-fix:
- The message change is wider than this tool:
ensure_write_path(surface_common.py:362-364) is shared by every_check_writecall site, so every MCP write refusal now prints the operator's allowed roots. Low risk and asked for by #1108, but if scope discipline matters the hint could stay insidealgorithm_spec. - A directory target can now contain the default spec. When the chosen root is the target directory or inside it,
mcp.py:562-565writes the spec inside the target: probed withkind="skill_dir"andarchive_selection, allowlist(target,)→<target>/agentdescent.archive_selection.spec.jsonwritten; target ==$AGENTDESCENT_HOMEwith the variable unset → same; allowlist(target/sub,)→ written there. Base refused all three, and the dropped commentmcp.py:541-543at base said never inside a directory target. The file stays inside the allowlist, so this is a lost property in a corner, not a bypass; the tool description atmcp.py:146should either keep that promise (pick a root outside the target, or refuse when none exists) or drop it. No test covers a directory target. mcp.py:580-585builds the example fromsurface_write_dirs[0]and the rawnameargument whenoutis supplied, not the registered name. It is an error string, never a write path, so harmless, but the example can name an unregistered spelling.
Closes #1108
algorithm_spectold hosts — in its tool description and in the sharedSKILL.md— that an omittedoutwrites the starter spec beside the user's target. The default write allowlist is the server's cwd plus$AGENTDESCENT_HOME, so for any target outside those two roots the shortest documented path was refused. Measured at base5048349a, clean worktree, both variables unset, target in a directory that is neither:What changed
agentdescent/mcp.py— an omittedoutnow resolves throughdefault_write_root(...):$AGENTDESCENT_HOME/agentdescent.<name>.spec.jsonwhen the operator's allowlist contains that home (it does when the variable is unset), otherwise the first allowed root. The explicit-outcheck is untouched (fix(mcp): algorithm_spec writes its spec without the server's write allowlist #1018). A refused explicitoutnow appends the allowed roots and anoutunder one of them, so the error is actionable rather than only naming the variable. The tool description says where the default lands.agentdescent/surface_common.py—surface_home()(one normalisation shared with the default roots) anddefault_write_root(allow), which raises an explicit "no write directory is allowed" when the allowlist is empty instead of inventing a root.ensure_write_pathnames the allowed roots in its message.agentdescent/integrations/SKILL.mdand the two host trees rendered from it (integrations/claude-code/skills/agentdescent/SKILL.md,integrations/dsh-agentdescent/lib/index.js) — the sentence now says$AGENTDESCENT_HOME/ an allowed root, never beside the target.tests/test_mcp_algorithm_spec_default_out.py(new) — the default lands under the home root, under the first explicit root, never beside the target; an explicit outsideoutis still refused and names a usable one; an empty allowlist says so; description and skill stop teaching the beside-the-target default.tests/test_mcp_algorithm_spec_allowlist.py— the row that pinned "default out outside an explicit allowlist is refused" becomes "the default goes to the allowed root": under this fix the default never lands outside, and that row was pinning the bug. The explicit-outrefusal row is unchanged.changelog.d/1108-algorithm-spec-default-out.md— oneFixedfragment.Red at base
5048349aClean worktree at
5048349aaceb1ad4c93318581f9a2b49481a5a99, only the new test file copied in (git status: one untracked file):Verification at the tip
Tip SHA: f1677e9
pytest -q tests/test_mcp_algorithm_spec_default_out.py→ 6 passedpytest -q tests/test_mcp_algorithm_spec_allowlist.py tests/test_mcp_algorithm_spec.py→ 11 passedtest_cli_governed,test_cli_tenant,test_cli_meta_campaign,test_cli_surface_p1,test_persistent_tenancy,test_cli_experience_cycle) → 40 passedpytest -q tests/test_integrations.py→ 137 passed, 2 skipped, 8 failed; the same 8 fail in a pristine worktree at5048349a(they run the venv'sagentdescentlauncher while the checkout shadows it:RuntimeError: shadowed by the host cwd), so they are this box, not this diffout→ok: True,spec_path: $AGENTDESCENT_HOME/agentdescent.gepa.spec.json, nothing beside the target; explicit/tmp/outside/spec.json→ok: False, error names both allowed roots andpass \out` under one of those roots, e.g. '…/server/agentdescent.gepa.spec.json'`python -m tools.gen_api_docs --check→docs/api.md is up to datepython -m tools.changelog_fragments check→50 changelog fragment(s) OKNot run:
mkdocs build --strict— mkdocs is not installed in this clone's venv; CI'sbuildleg is the lineagentdescent install …) end to end — the rendered trees are asserted equal to the package bytest_integrations, which rantests/test_docs_links.py—markdownis not installed here (environment, not this diff)test (3.9)–test (3.13)runs are that confirmationSize: 8 files,
+211/−17against base5048349a; T2 by.github/agent/risk-rules.json(agentdescent/mcp.pyandsurface_common.pyare package code; docs, tests andchangelog.d/are lower).Same-repo head:
maintainer_can_modifyis requested; this branch is in the same repository, and GitHub only tracks that flag for fork heads, so it reportsnullhere — recorded rather than worked around.Written-by: AgentDescent Dev-3
Bot: AgentDescent Dev-3