From f8eeb916830899cfcdb8cf7447972b1e0ca1c0e4 Mon Sep 17 00:00:00 2001 From: mukunda katta Date: Wed, 22 Apr 2026 22:22:12 -0700 Subject: [PATCH 1/3] fix(session): persist all Usage fields on save Cache token fields (cache_creation_input_tokens, cache_read_input_tokens) were dropped when saving a session. On resume, Usage(**data["usage"]) would reconstruct those fields as zero, silently losing accumulated cache token counts across sessions. --- src/astra/session/storage.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/astra/session/storage.py b/src/astra/session/storage.py index c65d648..b1b7c89 100644 --- a/src/astra/session/storage.py +++ b/src/astra/session/storage.py @@ -24,6 +24,8 @@ def save(self, session_id: str, messages: list[dict], usage: Usage) -> str: "usage": { "input_tokens": usage.input_tokens, "output_tokens": usage.output_tokens, + "cache_creation_input_tokens": usage.cache_creation_input_tokens, + "cache_read_input_tokens": usage.cache_read_input_tokens, }, } path.write_text(json.dumps(data, indent=2, default=str)) From a70329af8ad62c81c59609f4159df11458cbd296 Mon Sep 17 00:00:00 2001 From: mukunda katta Date: Wed, 22 Apr 2026 22:22:15 -0700 Subject: [PATCH 2/3] fix(permissions): unknown tools prompt in DEFAULT mode instead of auto-allowing In DEFAULT mode, tools not in ALWAYS_ALLOW or ALWAYS_ASK_DEFAULT fell through to an unconditional ALLOW. Any future tool (e.g. MCP tools not yet prefixed with mcp__) would silently execute without confirmation, violating the intent of DEFAULT mode. --- src/astra/permissions/checker.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/astra/permissions/checker.py b/src/astra/permissions/checker.py index 9cf8851..7fcf814 100644 --- a/src/astra/permissions/checker.py +++ b/src/astra/permissions/checker.py @@ -34,4 +34,6 @@ def check(self, tool_name: str, tool_input: dict[str, Any]) -> PermissionDecisio return PermissionDecision.ALLOW if tool_name in ALWAYS_ASK_DEFAULT: return PermissionDecision.ASK - return PermissionDecision.ALLOW + # Unknown tools not in ALWAYS_ALLOW or ALWAYS_ASK_DEFAULT require + # confirmation in DEFAULT mode rather than silently executing. + return PermissionDecision.ASK From 0efc46f9978ca483288256ece57e2f08905b64ec Mon Sep 17 00:00:00 2001 From: mukunda katta Date: Thu, 23 Apr 2026 07:48:14 -0700 Subject: [PATCH 3/3] fix(ci): restore pytest norecursedirs to exclude reference directory The [tool.pytest.ini_options] section with norecursedirs = ["reference"] was accidentally dropped in the previous commit, causing pytest to collect tests from reference/claw-code-main/tests/ which import a local `src` module not on the Python path. --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 96e7170..be9934b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,3 +26,6 @@ dev = [ [tool.setuptools.packages.find] where = ["src"] + +[tool.pytest.ini_options] +norecursedirs = ["reference"]