fix(moments): the tools import the delivery module, and the tool-list cache leaves the swept directory (milestone 458 step 4a, #4922)
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / integration (push) Successful in 49s
CI & Build / TypeScript typecheck (push) Successful in 52s
CI & Build / Python tests (push) Successful in 1m48s
CI & Build / Build & push image (push) Successful in 32s
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / integration (push) Successful in 49s
CI & Build / TypeScript typecheck (push) Successful in 52s
CI & Build / Python tests (push) Successful in 1m48s
CI & Build / Build & push image (push) Successful in 32s
Two guards caught 7865313:
- test_mcp_tool_processes reads every coroutine in a tool module's
namespace as a tool, and a name-imported attach_moment_rules looked
like one. All seven modules now call moment_delivery.attach_moment_rules,
and the parity guard accepts the attribute form.
- The session-ledger convention: a file in a swept directory must be a
.ids ledger. The tool-list cache describes the install, not the
context, so it moves to its own directory, scribe-moment, where a
compaction does not sweep it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+4
-3
@@ -221,9 +221,10 @@ def _no_moment_delivery(request):
|
||||
|
||||
update_task, the create_* record tools and the milestone tools now hand
|
||||
back the rules mounted on the moment they mark, and finding those is two
|
||||
database reads. Patched BENEATH the attach, at `deliver_for_act`, because
|
||||
the tools bind `attach_moment_rules` by name at import time. Skipped for
|
||||
integration tests; tests/test_moment_delivery.py binds the real one.
|
||||
database reads. Patched BENEATH the attach, at `deliver_for_act`, so the
|
||||
attach itself — its fail-open and its non-dict pass-through — still runs.
|
||||
Skipped for integration tests; tests/test_moment_delivery.py binds the
|
||||
real one.
|
||||
"""
|
||||
if request.node.get_closest_marker("integration"):
|
||||
yield
|
||||
|
||||
@@ -346,8 +346,10 @@ def _attached_names(path: Path) -> dict[str, set[str]]:
|
||||
if not isinstance(node, ast.AsyncFunctionDef):
|
||||
continue
|
||||
for call in ast.walk(node):
|
||||
if (isinstance(call, ast.Call) and isinstance(call.func, ast.Name)
|
||||
and call.func.id == "attach_moment_rules" and len(call.args) > 1
|
||||
func = call.func if isinstance(call, ast.Call) else None
|
||||
name = (func.id if isinstance(func, ast.Name)
|
||||
else func.attr if isinstance(func, ast.Attribute) else "")
|
||||
if (name == "attach_moment_rules" and len(call.args) > 1
|
||||
and isinstance(call.args[1], ast.Constant)):
|
||||
out.setdefault(node.name, set()).add(call.args[1].value)
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user