Raiff1982 commited on
Commit
a7fb915
·
verified ·
1 Parent(s): bf4c498

Backport tag-leak fix to codette_orchestrator.py

Browse files

The deployed strip was canonical-only and the call site gated it on has_tool_calls(text) -- so it ran only when the text held a VALID call and stood down for the malformed leftovers it exists to remove. '<tool>empathy</tool>' is a perspective with no args, not a call: the guard said no and it rendered.

Now unconditional, and the strip also handles dangling closers named after a tool (including the misspelled '</bearig>', which truncated a real answer mid-sentence) and unwraps paired named tags rather than deleting them -- the sentence inside was hers.

Bounded: '</div>', '</span>', '</thinking>' are untouched.

Surgical backport, NOT a bulk sync. perspective_registry.py is deliberately NOT updated: only 8 adapters are uploaded here, so adding constraint_tracker would make it selectable with no weights behind it -- recreating the exact bug fixed locally today.

Files changed (1) hide show
  1. inference/codette_orchestrator.py +6 -1
inference/codette_orchestrator.py CHANGED
@@ -972,7 +972,12 @@ class CodetteOrchestrator:
972
 
973
  # No tool calls (or final round) — we're done
974
  # Strip any leftover tool tags from final response
975
- clean_text = strip_tool_calls(text) if has_tool_calls(text) else text
 
 
 
 
 
976
  break
977
 
978
  # SELF-CORRECTION LOOP: Detect violations and re-generate if needed (max 1 retry)
 
972
 
973
  # No tool calls (or final round) — we're done
974
  # Strip any leftover tool tags from final response
975
+ # Unconditional. Gating on has_tool_calls stood the cleanup down for
976
+ # exactly the malformed leftovers it exists to remove: `<tool>empathy
977
+ # </tool>` is not a valid call, so the guard said no and it rendered.
978
+ # strip_tool_calls is a no-op on clean prose, so the guard bought
979
+ # nothing and cost the one case it was there for. (2026-08-17)
980
+ clean_text = strip_tool_calls(text)
981
  break
982
 
983
  # SELF-CORRECTION LOOP: Detect violations and re-generate if needed (max 1 retry)