Skip to content

Commit 2d86e2b

Browse files
sourcehawkclaude
andcommitted
fix(skills/bounding-heavy-commands): name the command that a check runs inside among the held commands
The check skipped its own scope for the held lines as it does for the count of unused budgets. So a check run from inside a bounded command did not name that command, although the held lines name every running bounded command. The held lines now skip only the probe scopes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f0723f5 commit 2d86e2b

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎skills/bounding-heavy-commands/scripts/bounded_run.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ def mib(value: Optional[int]) -> str:
13651365
log("check slots=%d slot=%dM free-slots=%s free=%s unused=%s line=%s" % (
13661366
count, settings.slot_mib, "-" if free_slots is None else free_slots, mib(available), mib(outstanding),
13671367
"free" if line is not None else "busy"))
1368-
for held in held_commands(scopes, skip) if scopes is not None else []:
1368+
for held in held_commands(scopes, ()) if scopes is not None else []:
13691369
log("check held " + held)
13701370
for budget in budgets:
13711371
needed = slots_needed(budget, settings.slot_mib, count)

‎skills/bounding-heavy-commands/scripts/tests/test_bounded_run.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,6 +2103,23 @@ def held(parent, skip):
21032103
self.assertEqual(self.lines[1], "check held unit=bounded-run-7-abcdef budget=4096M used=100M age=5s dir=/w command=tool")
21042104
self.assertTrue(self.lines[2].startswith("check budget=2048M "), self.lines)
21052105

2106+
def test_a_check_inside_a_bounded_command_names_that_command_too(self):
2107+
self.environ.pop("BOUNDED_RUN_NO_CAP")
2108+
output = "0::/user.slice/app.slice/bounded-run-1-000000-probe.scope\n"
2109+
skips = []
2110+
2111+
def held(parent, skip):
2112+
skips.append(list(skip))
2113+
return []
2114+
2115+
options = bounded_run.parse_arguments(["--check"])
2116+
with mock.patch.object(bounded_run, "probe_cap", return_value=output), \
2117+
mock.patch.object(bounded_run, "own_scope_name", return_value="bounded-run-2-111111.scope"), \
2118+
mock.patch.object(bounded_run, "unused_budget_mib", return_value=0), \
2119+
mock.patch.object(bounded_run, "held_commands", held):
2120+
bounded_run.check(options.budgets, self.environ, read_available=lambda: 9000)
2121+
self.assertEqual(skips, [[]])
2122+
21062123
def test_no_held_line_without_a_cap(self):
21072124
self.hold("slot-000.lock")
21082125
self.assertFalse(any(line.startswith("check held") for line in self.check(["2G"])))

0 commit comments

Comments
 (0)