core/agent+cli: wire max_context_chars and re-raise CancelledError

Propagate context budget from [agent] config; preserve cancel through
tool invoke for mid-turn interruption.
This commit is contained in:
2026-07-14 23:42:55 +08:00
parent 5cfe4d6a24
commit f31032b801
7 changed files with 16 additions and 4 deletions
+3
View File
@@ -17,6 +17,7 @@ def test_agent_section_defaults(tmp_path: Path) -> None:
assert store.agent_config.parallel_tools is True
assert store.agent_config.confirm_destructive is True
assert store.agent_config.path_denylist == []
assert store.agent_config.max_context_chars == 200_000 # noqa: PLR2004
def test_agent_section_parse(tmp_path: Path) -> None:
@@ -29,6 +30,7 @@ max_tool_result_chars = 100
parallel_tools = false
confirm_destructive = false
path_denylist = ["/secrets/", ".ssh/"]
max_context_chars = 5000
""",
encoding="utf-8",
)
@@ -38,3 +40,4 @@ path_denylist = ["/secrets/", ".ssh/"]
assert store.agent_config.parallel_tools is False
assert store.agent_config.confirm_destructive is False
assert store.agent_config.path_denylist == ["/secrets/", ".ssh/"]
assert store.agent_config.max_context_chars == 5000 # noqa: PLR2004