Compare commits

..

3 Commits

Author SHA1 Message Date
didericis-codex cd56705177 test(gateway): cover single and simultaneous daemon crashes
tracker-policy-pr / check-pr (pull_request) Successful in 6s
lint / lint (push) Successful in 1m2s
test / integration-firecracker (pull_request) Successful in 3m23s
test / unit (pull_request) Failing after 38s
test / integration-docker (pull_request) Successful in 32s
test / coverage (pull_request) Has been skipped
test / publish-infra (pull_request) Has been skipped
2026-07-23 18:55:29 -04:00
didericis-codex e0423b9b3c fix(gateway): restart dead children before completion check
lint / lint (push) Successful in 58s
2026-07-23 18:55:27 -04:00
didericis-claude 44122e2728 fix(egress): restart dead daemons and cap inbound scan body size (#455)
test / integration-docker (pull_request) Successful in 20s
lint / lint (push) Successful in 1m1s
test / unit (pull_request) Failing after 1m46s
test / integration-firecracker (pull_request) Successful in 3m22s
test / coverage (pull_request) Has been skipped
test / publish-infra (pull_request) Has been skipped
tracker-policy-pr / check-pr (pull_request) Failing after 10m4s
Two complementary fixes for the egress gateway OOM:

1. gateway_init: auto-restart any daemon that dies unexpectedly. The
   supervisor already had restart_daemon()/request_restart() logic; this
   wires it into tick() so an OOM-killed mitmdump is respawned without
   operator intervention. Implements the "eventual" failure policy
   described in the original module docstring.

2. egress_addon: cap response body bytes passed to the DLP inbound scan
   at EGRESS_INBOUND_SCAN_LIMIT_BYTES (default 1 MiB). mitmproxy buffers
   the full response before the hook fires; capping at scan time limits
   the additional amplification from decoded text and regex strings. Bodies
   over the limit emit an egress_scan_truncated log event. Set to 0 to
   disable the cap.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-23 22:49:34 +00:00
4 changed files with 2 additions and 35 deletions
+1 -6
View File
@@ -14,7 +14,6 @@ the private orchestrator `_launch_bottle`.
from __future__ import annotations
import argparse
import io
import os
import shutil
import sys
@@ -196,11 +195,7 @@ def _start_headless(
path, so the agent still execs on the inherited stdio/PTY — an
orchestrator allocates that PTY and relays it to its
desktop/mobile clients."""
try:
stdin_fd = sys.stdin.fileno()
except io.UnsupportedOperation:
stdin_fd = -1
if not os.isatty(stdin_fd):
if not os.isatty(sys.stdin.fileno()):
die(
"--headless requires a PTY on stdin; run via:\n"
" script -q /dev/null ./cli.py start ..."
+1 -1
View File
@@ -57,7 +57,7 @@ def _merge_two_bottles_runtime(base: "ManifestBottle", override: "ManifestBottle
n for n in override_repos_by_name if n not in base_repos_by_name
]
merged_git = tuple(
override_repos_by_name[n] if n in override_repos_by_name else base_repos_by_name[n]
override_repos_by_name.get(n, base_repos_by_name[n])
for n in merged_repos_names
)
-3
View File
@@ -69,9 +69,6 @@ class TestCmdStartHeadless(unittest.TestCase):
self._modal = patch.object(tui_mod, "name_color_modal").start()
patch.dict(os.environ, {}, clear=False).start()
os.environ.pop("BOT_BOTTLE_BACKEND", None)
# PTY check uses os.isatty(sys.stdin.fileno()); stub both so
# headless unit tests aren't blocked on a real TTY.
patch("bot_bottle.cli.start.os.isatty", return_value=True).start()
self.addCleanup(patch.stopall)
def _spec(self):
-25
View File
@@ -25,10 +25,6 @@ def _bottle(**kwargs: object) -> ManifestBottle:
return ManifestBottle.from_dict("test", kwargs)
def _git_repo(url: str) -> dict[str, object]:
return {"url": url, "key": {"provider": "gitea", "forge_token_env": "TOK"}}
class TestMergeBottlesRuntime(unittest.TestCase):
def test_single_bottle_returns_as_is(self):
b = _bottle(env={"FOO": "1"})
@@ -119,27 +115,6 @@ class TestMergeBottlesRuntime(unittest.TestCase):
self.assertEqual("2", result.env["B"])
self.assertEqual("3", result.env["C"])
def test_git_repo_only_in_override_does_not_raise(self):
# Regression for issue #457: override bottle declares a repo that the
# base doesn't have → KeyError on base_repos_by_name[n].
base = _bottle(env={"X": "base"})
override = _bottle(**{"git-gate": {"repos": {"myrepo": _git_repo("ssh://git@example.com/repo.git")}}})
result = merge_bottles_runtime([base, override])
self.assertIn("myrepo", [e.Name for e in result.git])
def test_git_repo_only_in_base_survives_override(self):
base = _bottle(**{"git-gate": {"repos": {"myrepo": _git_repo("ssh://git@example.com/repo.git")}}})
override = _bottle(env={"X": "override"})
result = merge_bottles_runtime([base, override])
self.assertIn("myrepo", [e.Name for e in result.git])
def test_git_repo_override_wins_by_name(self):
base = _bottle(**{"git-gate": {"repos": {"myrepo": _git_repo("ssh://git@base.example.com/repo.git")}}})
override = _bottle(**{"git-gate": {"repos": {"myrepo": _git_repo("ssh://git@override.example.com/repo.git")}}})
result = merge_bottles_runtime([base, override])
self.assertEqual(1, len(result.git))
self.assertEqual("ssh://git@override.example.com/repo.git", result.git[0].Upstream)
def test_empty_list_raises(self):
with self.assertRaises(ValueError):
merge_bottles_runtime([])