Skip to content

Commit eea2b93

Browse files
committed
fix(approval): preserve newer deliberation generations
1 parent b3a891b commit eea2b93

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/pythinker_code/soul/approval.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,11 @@ def deliberation_gate(self, tool_call: ToolCall) -> str | None:
284284
# a subagent's identical call from consuming the main agent's one-shot (state is
285285
# shared via Approval.share()).
286286
prior_generation = self._state.deliberated_fingerprints.get(fingerprint)
287-
if prior_generation is not None and prior_generation < generation:
288-
del self._state.deliberated_fingerprints[fingerprint]
289-
return None
287+
if prior_generation is not None:
288+
if prior_generation < generation:
289+
del self._state.deliberated_fingerprints[fingerprint]
290+
return None
291+
return reason
290292
self._state.deliberated_fingerprints[fingerprint] = generation
291293
return reason
292294

tests/core/test_approval_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ def test_older_generation_duplicate_destructive_call_still_bounces() -> None:
185185
assert approval.deliberation_gate(_shell_call("rm -rf build")) is not None
186186
with deliberation_scope("root", 1):
187187
assert approval.deliberation_gate(_shell_call("rm -rf build")) is not None
188+
with deliberation_scope("root", 2):
189+
assert approval.deliberation_gate(_shell_call("rm -rf build")) is not None
188190

189191

190192
def test_deliberation_gate_conditions() -> None:

0 commit comments

Comments
 (0)