A short model name matches a segment of the part after the pick's last slash only
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
210290e8af
commit
3a3c9d0070
2 files changed
+11
-2
No files matched your search
+2
-2
@@ -118,10 +118,10 @@ def is_call(command_line):
|
|||||||
|
|
||||||
def claim(s, text, segment=False):
|
def claim(s, text, segment=False):
|
||||||
"""Spend the pick that this delegation's model text names; False when none of the picks fits. With `segment` (the
|
"""Spend the pick that this delegation's model text names; False when none of the picks fits. With `segment` (the
|
||||||
host names its models shortly: `fast` for `maker-fast-2`) one whole segment of a picked id that has a letter fits."""
|
host names its models shortly: `fast` for `maker-fast-2`) one whole `-` segment of a picked id's last `/` part that has a letter fits."""
|
||||||
for name in s.get("picked") or []:
|
for name in s.get("picked") or []:
|
||||||
if any(re.search(r"(?<![a-z0-9.-])%s(?![a-z0-9.-])" % re.escape(n), text.lower()) for n in (name, name.rsplit("/", 1)[-1])) or (
|
if any(re.search(r"(?<![a-z0-9.-])%s(?![a-z0-9.-])" % re.escape(n), text.lower()) for n in (name, name.rsplit("/", 1)[-1])) or (
|
||||||
segment and re.search("[a-z]", text) and text.lower() in re.split("[-/]", name)):
|
segment and re.search("[a-z]", text) and text.lower() in name.rsplit("/", 1)[-1].split("-")):
|
||||||
s["picked"].remove(name)
|
s["picked"].remove(name)
|
||||||
starts = s["starts"] if isinstance(s.get("starts"), dict) else {}
|
starts = s["starts"] if isinstance(s.get("starts"), dict) else {}
|
||||||
starts[name] = (starts[name] if isinstance(starts.get(name), list) else []) + [time.time()]
|
starts[name] = (starts[name] if isinstance(starts.get(name), list) else []) + [time.time()]
|
||||||
|
|||||||
@@ -1213,6 +1213,15 @@ class Core(unittest.TestCase):
|
|||||||
for model, rc in (("claude-haiku-5-5", 0), ("haiku", 2), ("5", 2)): # target.model: whole names only, as before
|
for model, rc in (("claude-haiku-5-5", 0), ("haiku", 2), ("5", 2)): # target.model: whole names only, as before
|
||||||
self.assertEqual((pick("routine"), task(model)), (0, rc), model)
|
self.assertEqual((pick("routine"), task(model)), (0, rc), model)
|
||||||
|
|
||||||
|
def test_a_short_model_name_is_matched_only_against_the_part_after_the_last_slash(self):
|
||||||
|
self.table(HEADER + "| claude-sonnet-5-5 | host subagent model `sonnet` | hard | per use | everything | |\n"
|
||||||
|
"| opencode-go/claude-haiku-5-5 | T3 Code delegate_task, model opencode-go/claude-haiku-5-5 | routine | flat | quick | |\n")
|
||||||
|
self.hook("tick")
|
||||||
|
self.hook("prompt", prompt="go")
|
||||||
|
self.done()
|
||||||
|
for cls, model, rc in (("routine", "go", 2), ("routine", "opencode", 2), ("routine", "haiku", 0), ("hard", "sonnet", 0)):
|
||||||
|
self.assertEqual((self.sisi("pick", cls, sid="s1")[0], self.tool("Agent", tool_input={"model": model})[0]), (0, rc), model)
|
||||||
|
|
||||||
def test_the_maker_column_is_read_by_name_and_both_shapes_record(self):
|
def test_the_maker_column_is_read_by_name_and_both_shapes_record(self):
|
||||||
sys.path.insert(0, REPO)
|
sys.path.insert(0, REPO)
|
||||||
from sisi import models
|
from sisi import models
|
||||||
|
|||||||
Reference in new issue
Block a user