fix(backend/copilot): use resolved path for bridging, explicit return None

- Pass `resolved` (realpath-expanded) to `_bridge_to_sandbox` in
  `_read_file_handler` so the bridge target matches the file that was
  actually read (addresses review comment).
- Replace bare `return` with explicit `return None` in
  `_bridge_to_sandbox` large-file skip path for consistency with the
  declared `str | None` return type.
This commit is contained in:
Zamil Majdy
2026-04-02 08:19:25 +02:00
parent 0e567df1da
commit 3a49086c3d
2 changed files with 2 additions and 2 deletions

View File

@@ -355,7 +355,7 @@ async def _bridge_to_sandbox(
file_size,
basename,
)
return
return None
with open(expanded, "rb") as fh:
content = fh.read()
if file_size <= _BRIDGE_SHELL_MAX_BYTES:

View File

@@ -393,7 +393,7 @@ async def _read_file_handler(args: dict[str, Any]) -> dict[str, Any]:
text = "".join(selected)
sandbox = _current_sandbox.get(None)
if sandbox is not None:
bridged = await _bridge_to_sandbox(sandbox, file_path, offset, limit)
bridged = await _bridge_to_sandbox(sandbox, resolved, offset, limit)
if bridged:
text += f"\n[Sandbox copy available at {bridged}]"
return _mcp_ok(text)