Compare commits

..

7 Commits

Author SHA1 Message Date
Ahmed Allam
56e9ae982c runtime: read_only local sources become :ro bind mounts
A local_code target can mark its tree read_only; collect_local_sources
forwards the flag and build_bind_mounts mounts the tree read-only instead
of relying on host mode bits, skipping the per-metadata remounts since the
whole tree is already immutable. Used for pulled container image layouts.
2026-09-20 06:10:13 +03:00
Ahmed Allam
355a8bb437 fix(reporting): move the git blame hint to the end of the tool description 2026-09-18 21:39:35 +03:00
Ahmed Allam
77a0cf839b fix(reporting): make the git blame hint a casual inline note 2026-09-18 21:39:35 +03:00
Ahmed Allam
cafa4b19fd fix(reporting): keep git blame guidance to the technical_analysis field 2026-09-18 21:39:35 +03:00
alex s
976835194d Prompt agents to include local Git blame in technical details (#1329)
* Enrich issue technical details with local Git blame

* Bound report history enrichment and require unambiguous repository identity

* test(history): drive attribution through the CLI scan setup and isolate git config

* Simplify Git blame attribution to existing reporting instructions

* Make local blame guidance reliable in live reporting
2026-09-18 13:05:53 -04:00
Ahmed Allam
4c1f00d1ee fix(runtime): tear the sandbox down when staging is cancelled
CancelledError is not an Exception, so a run cancelled during the extra-file
upload or unpack left a created-but-uncached sandbox running.
2026-09-17 21:53:35 +03:00
Ahmed Allam
46d7bdb290 fix(runtime): place extra files as agent-writable sandbox files on every backend
Extra files (knowledge trees, workspace files) reached the docker sandbox as
per-file read-only bind mounts whose parent directories docker created as
root, so the sandbox user could neither edit them nor create siblings. They
now travel as one tar archive uploaded after bring-up and unpacked as the
sandbox user, on every backend.
2026-09-17 21:53:35 +03:00
6 changed files with 59 additions and 5 deletions

View File

@@ -1323,6 +1323,7 @@ def collect_local_sources(targets_info: list[dict[str, Any]]) -> list[dict[str,
"source_path": details["target_path"],
"workspace_subdir": workspace_subdir,
"protect_metadata": True,
"read_only": bool(details.get("read_only")),
}
)

View File

@@ -70,8 +70,9 @@ def build_bind_mounts(local_sources: list[dict[str, Any]]) -> list[dict[str, Any
continue
resolved = Path(host_path).expanduser().resolve()
target = f"{_WORKSPACE_ROOT}/{ws_subdir}"
bind_mounts.append({"source": str(resolved), "target": target, "read_only": False})
if src.get("protect_metadata"):
read_only = bool(src.get("read_only"))
bind_mounts.append({"source": str(resolved), "target": target, "read_only": read_only})
if src.get("protect_metadata") and not read_only:
bind_mounts.extend(_metadata_mounts(resolved, target))
return bind_mounts

View File

@@ -1323,6 +1323,12 @@ async def create_vulnerability_report(
A restrictive CSP that blocks inline script execution would
reduce impact and lower the severity.
fix_effort: "low"
Nice to have: for code findings, if the checkout has git history, a quick
``git blame`` (quote the paths) on the vulnerable line is worth weaving into
``technical_analysis`` — who last touched it, when, and in which commit, as
part of the prose, not a separate section. Skip it if the line is
uncommitted or the command fails.
"""
(
http_exchange_ids,

View File

@@ -30,7 +30,26 @@ def _local_target(target_path: str) -> dict[str, Any]:
def test_collect_local_sources_protects_the_users_own_git() -> None:
sources = collect_local_sources([_local_target("/code")])
assert sources == [
{"source_path": "/code", "workspace_subdir": "repo", "protect_metadata": True}
{
"source_path": "/code",
"workspace_subdir": "repo",
"protect_metadata": True,
"read_only": False,
}
]
def test_collect_local_sources_forwards_read_only() -> None:
target = _local_target("/layout")
target["details"]["read_only"] = True
sources = collect_local_sources([target])
assert sources == [
{
"source_path": "/layout",
"workspace_subdir": "repo",
"protect_metadata": True,
"read_only": True,
}
]

View File

@@ -1089,6 +1089,16 @@ def test_tool_descriptions_include_formatting_guidance() -> None:
assert "reachab" in dep_desc.lower()
def test_git_blame_hint_is_a_trailing_note() -> None:
desc = create_vulnerability_report.description
assert desc.count("blame") == 1
tail = desc[desc.index("Nice to have:") :]
assert "git blame" in tail
assert "technical_analysis" in tail
assert "Example" not in tail
assert "blame" not in update_vulnerability_report.description
def test_vuln_tool_exposes_new_params() -> None:
props = create_vulnerability_report.params_json_schema["properties"]
for field in (

View File

@@ -27,8 +27,15 @@ from strix.runtime.session_manager import (
)
def _source(subdir: str, path: str, *, protect_metadata: bool = False) -> dict[str, Any]:
return {"source_path": path, "workspace_subdir": subdir, "protect_metadata": protect_metadata}
def _source(
subdir: str, path: str, *, protect_metadata: bool = False, read_only: bool = False
) -> dict[str, Any]:
return {
"source_path": path,
"workspace_subdir": subdir,
"protect_metadata": protect_metadata,
"read_only": read_only,
}
def test_source_becomes_writable_bind_mount(tmp_path: Path) -> None:
@@ -124,6 +131,16 @@ def test_clone_keeps_its_git_writable(tmp_path: Path) -> None:
assert [m["target"] for m in mounts] == ["/workspace/clone"]
def test_read_only_source_is_one_read_only_mount(tmp_path: Path) -> None:
(tmp_path / ".git").mkdir()
mounts = build_bind_mounts(
[_source("image", str(tmp_path), protect_metadata=True, read_only=True)]
)
assert mounts == [
{"source": str(tmp_path.resolve()), "target": "/workspace/image", "read_only": True}
]
def test_multiple_sources_each_get_a_mount(tmp_path: Path) -> None:
first = tmp_path / "first"
second = tmp_path / "second"