Optimize: a single /optimize call in Optimizer, the detectors and the tools
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
91cd39525e
commit
beaa248687
6 files changed
+47
-55
No files matched your search
+10
-11
@@ -134,14 +134,16 @@ def check_optimization():
|
||||
assert analysis.state("NORDEND_a")["optimization"] is None
|
||||
# without Optimizer, then without agents: a clear refusal, not an error trace
|
||||
assert "optimizer/" in refuses(analysis.optimize, "NORDEND_a")
|
||||
(analysis.OPTIMIZER / ".claude" / "skills" / "improve").mkdir(parents=True)
|
||||
(analysis.OPTIMIZER / ".claude" / "skills" / "improve" / "SKILL.md").write_text("improve")
|
||||
(analysis.OPTIMIZER / ".claude" / "skills" / "optimize").mkdir(parents=True)
|
||||
(analysis.OPTIMIZER / ".claude" / "skills" / "optimize" / "SKILL.md").write_text("optimize")
|
||||
assert "agents/" in refuses(analysis.optimize, "NORDEND_a")
|
||||
(analysis.AGENTS / ".claude-plugin").mkdir(parents=True)
|
||||
(analysis.AGENTS / ".claude-plugin" / "plugin.json").write_text("{}")
|
||||
assert "optimizer/" in refuses(analysis.optimize, "NORDEND_a") # without the data, labeling, detectors links of Optimizer
|
||||
assert "optimizer/" in refuses(analysis.optimize, "NORDEND_a") # without the links of Optimizer
|
||||
for link in ("data", "labeling", "detectors"):
|
||||
(analysis.OPTIMIZER / link).mkdir()
|
||||
assert "optimizer/" in refuses(analysis.optimize, "NORDEND_a") # without its tools link
|
||||
(analysis.OPTIMIZER / "tools").mkdir()
|
||||
assert analysis.optimize("NORDEND_a") == {}
|
||||
assert analysis.state("NORDEND_a")["optimization"]["state"] == "running"
|
||||
refuses(analysis.optimize, "NORDEND_a")
|
||||
@@ -152,18 +154,15 @@ def check_optimization():
|
||||
while analysis.state("NORDEND_a")["optimization"]["state"] == "running":
|
||||
time.sleep(0.05)
|
||||
assert analysis.state("NORDEND_a")["optimization"]["state"] == "done"
|
||||
args, k = launched[0] # /improve in Optimizer, on the range of the analysis, TO excluded
|
||||
assert len(launched) == 1, launched # a single call: /optimize in Optimizer, on the analysis
|
||||
args, k = launched[0]
|
||||
request = args[2]
|
||||
assert request.startswith("/improve ") and "STATION: data/NORDEND. FROM: 2026-11-04. TO: 2026-11-08." in request \
|
||||
and "OUT: sessions/NORDEND_a_" in request and "FAMILIES: labeling/families.md." in request \
|
||||
and "CONTEXT: labeling/auto/analyses/NORDEND_a/report.md." in request, request
|
||||
assert request.startswith("/optimize ANALYSIS: labeling/auto/analyses/NORDEND_a/. OUT: sessions/NORDEND_a_") \
|
||||
and "Caller's context:" in request, request
|
||||
assert k["cwd"] == analysis.OPTIMIZER.resolve() and "--plugin-dir" in args, (args, k)
|
||||
assert all("ANTHROPIC_API_KEY" not in kw["env"] for _, kw in launched), "an API key reaches claude"
|
||||
# isolated from the settings of the workstation (the user's plugins, hooks, MCP servers)
|
||||
assert all(a[a.index("--setting-sources") + 1] == "project,local" and "--strict-mcp-config" in a for a, _ in launched)
|
||||
args, k = launched[1] # then the tool-builder of the agents repository, on the tools repository
|
||||
assert args[args.index("--agent") + 1] == "agents:tool-builder" and "Tools: tools/" in args[2] \
|
||||
and args[2].endswith("/tools.md."), args
|
||||
analysis.analyses["NORDEND_b"]["state"] = "running" # a running analysis blocks the optimization
|
||||
refuses(analysis.optimize, "NORDEND_a")
|
||||
# after a restart: the stream ends with {"type": "end"} -> done; without that line -> interrupted; the summary of
|
||||
@@ -177,7 +176,7 @@ def check_optimization():
|
||||
analysis.optimizations.clear()
|
||||
assert analysis.state("NORDEND_a")["optimization"]["state"] == "interrupted"
|
||||
(analysis.SESSIONS / "NORDEND_a_20261113T1000Z").mkdir(parents=True)
|
||||
(analysis.SESSIONS / "NORDEND_a_20261113T1000Z" / "summary.md").write_text("# improve\n\n**Result**: none")
|
||||
(analysis.SESSIONS / "NORDEND_a_20261113T1000Z" / "summary.md").write_text("# optimize\n\n**Result**: none")
|
||||
# a new analysis of the same range (NORDEND_a_143000): its session is not the summary of NORDEND_a
|
||||
(analysis.SESSIONS / "NORDEND_a_143000_20261113T1100Z").mkdir(parents=True)
|
||||
(analysis.SESSIONS / "NORDEND_a_143000_20261113T1100Z" / "summary.md").write_text("# other analysis")
|
||||
|
||||
Reference in new issue
Block a user