@miller-tech/uap 2.36.1 → 2.36.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/policies/enforcers/__pycache__/_common.cpython-311.pyc +0 -0
- package/src/policies/enforcers/__pycache__/expert_review_required.cpython-311.pyc +0 -0
- package/src/policies/enforcers/__pycache__/quality_metrics_gate.cpython-311.pyc +0 -0
- package/templates/hooks/__pycache__/deliver_autoroute.cpython-311.pyc +0 -0
- package/tools/agents/scripts/__pycache__/toolcall_path_normalizer.cpython-311.pyc +0 -0
- package/tools/agents/scripts/anthropic_proxy.py +34 -1
- package/tools/agents/tests/test_signature_quality.py +51 -0
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -697,6 +697,24 @@ _FAILURE_DECLARATION_RE = re.compile(
|
|
|
697
697
|
re.IGNORECASE,
|
|
698
698
|
)
|
|
699
699
|
|
|
700
|
+
# The harness's own zero-exit envelope: the tool CALL succeeded, whatever the
|
|
701
|
+
# output QUOTES. Droid/BYOK appends "[Process exited with code N]" to every
|
|
702
|
+
# Execute result; other harnesses print their own form. Decisive in the
|
|
703
|
+
# flag-ABSENT path only (a client that declares is_error True still wins):
|
|
704
|
+
# 2026-10-26, cognition-engine fdc94474 -- two ERROR-LOOP hard stops were
|
|
705
|
+
# served on SIX successful state-checks whose `git diff` output quoted the
|
|
706
|
+
# session's own in-flight `eprintln!("pg-server: metrics: failed to bind
|
|
707
|
+
# ...")` line; the keyword sniff turned each clean diff into the same
|
|
708
|
+
# "failure" signature and the streak escalated to a 400.
|
|
709
|
+
_ZERO_EXIT_ENVELOPE_RE = re.compile(
|
|
710
|
+
r"\[process exited with code 0\]" # Droid / BYOK Execute result footer
|
|
711
|
+
r"|\bexited with code 0\b" # generic harness prose
|
|
712
|
+
r"|\bexit (?:code|status)\s*[:=]?\s*0\b" # 'exit code 0' / 'exit status: 0'
|
|
713
|
+
r"|\bexit_code=0\b" # python subprocess env style
|
|
714
|
+
r"|\bEXIT=0\b", # shell-echoed status
|
|
715
|
+
re.IGNORECASE,
|
|
716
|
+
)
|
|
717
|
+
|
|
700
718
|
|
|
701
719
|
def _is_successful_result(text: str) -> bool:
|
|
702
720
|
"""True when the payload structurally declares success.
|
|
@@ -867,10 +885,25 @@ def _error_signature_for_result(text: str, result_error: bool | None = None) ->
|
|
|
867
885
|
(_first_meaningful_signature), so an unfamiliar error
|
|
868
886
|
shape still forms a streak; a wrapper-only payload
|
|
869
887
|
stays unnameable -- DOUBLING-DOWN owns that shape.
|
|
870
|
-
absent ->
|
|
888
|
+
absent -> keyword heuristics as before, EXCEPT a payload that
|
|
889
|
+
carries the harness's zero-exit envelope
|
|
890
|
+
(_ZERO_EXIT_ENVELOPE_RE): the call succeeded, so
|
|
891
|
+
failure-shaped words it merely QUOTES (a git diff of
|
|
892
|
+
in-flight edits, a grep over source) cannot anchor a
|
|
893
|
+
streak. 2026-10-26: two ERROR-LOOP hard stops on six
|
|
894
|
+
clean state-checks whose git-diff output quoted the
|
|
895
|
+
session's own `eprintln!("...failed to bind...")`
|
|
896
|
+
source line; a declared True flag still wins over
|
|
897
|
+
the envelope.
|
|
871
898
|
"""
|
|
872
899
|
if result_error is False:
|
|
873
900
|
return ""
|
|
901
|
+
if result_error is None and _ZERO_EXIT_ENVELOPE_RE.search(text or ""):
|
|
902
|
+
# Flag-ABSENT and the harness's own footer says the call exited 0:
|
|
903
|
+
# the result is clean whatever the bytes quote. Only the heuristic
|
|
904
|
+
# path is narrowed -- is_error True/False keep their declared
|
|
905
|
+
# precedence above.
|
|
906
|
+
return ""
|
|
874
907
|
sig = _error_signature(text)
|
|
875
908
|
if sig or result_error is not True:
|
|
876
909
|
return sig
|
|
@@ -55,6 +55,20 @@ WORKTREE_STATUS = (
|
|
|
55
55
|
SHELL_SOURCE_READ = "die() { printf 'fatal: %s\\n' \"$*\" >&2; exit 1; }\n"
|
|
56
56
|
|
|
57
57
|
|
|
58
|
+
# 2026-10-26, cognition-engine fdc94474: state-check output that QUOTES the
|
|
59
|
+
# session's own in-flight source (a numbered read of the metrics region,
|
|
60
|
+
# a git diff of the wedge fix) plus the harness's zero-exit footer. Six
|
|
61
|
+
# flag-absent results of this shape manufactured both ERROR-LOOP hard stops.
|
|
62
|
+
DIFF_QUOTING_SOURCE = (
|
|
63
|
+
" M src/rust-pg-ext/Cargo.toml\n"
|
|
64
|
+
" M src/rust-pg-ext/src/bin/pg-server.rs\n"
|
|
65
|
+
"2784→ eprintln!(\"pg-server: metrics: failed to bind {addr}: {e}"
|
|
66
|
+
" — metrics endpoint disabled\");\n"
|
|
67
|
+
"+ return None;\n"
|
|
68
|
+
"\n[Process exited with code 0]"
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
|
|
58
72
|
class TracebackAnchoringTests(unittest.TestCase):
|
|
59
73
|
def test_decisive_line_anchors_not_the_header(self):
|
|
60
74
|
sig = proxy._error_signature(TRACEBACK_FULL)
|
|
@@ -225,6 +239,43 @@ class ReadOnlyContentTests(unittest.TestCase):
|
|
|
225
239
|
self.assertEqual(len(body["messages"]), 1)
|
|
226
240
|
|
|
227
241
|
|
|
242
|
+
class ZeroExitEnvelopeTests(unittest.TestCase):
|
|
243
|
+
"""A flag-ABSENT Execute result carrying the harness's zero-exit
|
|
244
|
+
envelope is a SUCCESS, whatever failure-shaped text its output QUOTES
|
|
245
|
+
(ledger 2026-10-26: two ERROR-LOOP hard stops served on six clean
|
|
246
|
+
state-checks whose output quoted an in-flight eprintln! source line)."""
|
|
247
|
+
|
|
248
|
+
def test_quoted_source_with_exit_zero_forms_no_signature(self):
|
|
249
|
+
m = proxy.SessionMonitor()
|
|
250
|
+
for _ in range(6):
|
|
251
|
+
m.note_tool_result_error(DIFF_QUOTING_SOURCE, None, tool_names=["execute"])
|
|
252
|
+
self.assertEqual(m.error_signature_streak, 0)
|
|
253
|
+
self.assertEqual(m.last_error_signature, "")
|
|
254
|
+
|
|
255
|
+
def test_exit_zero_streak_never_arms_the_guard(self):
|
|
256
|
+
m = proxy.SessionMonitor()
|
|
257
|
+
for _ in range(6):
|
|
258
|
+
m.note_tool_result_error(DIFF_QUOTING_SOURCE, None, tool_names=["execute"])
|
|
259
|
+
body = {"messages": [{"role": "user", "content": "go"}], "tool_choice": "auto"}
|
|
260
|
+
proxy._maybe_inject_error_loop_break(body, m)
|
|
261
|
+
self.assertEqual(m.error_loop_fires, 0)
|
|
262
|
+
self.assertEqual(len(body["messages"]), 1)
|
|
263
|
+
|
|
264
|
+
def test_nonzero_exit_still_keeps_heuristics(self):
|
|
265
|
+
payload = DIFF_QUOTING_SOURCE.replace(
|
|
266
|
+
"exited with code 0", "exited with code 1"
|
|
267
|
+
)
|
|
268
|
+
m = proxy.SessionMonitor()
|
|
269
|
+
m.note_tool_result_error(payload, None, tool_names=["execute"])
|
|
270
|
+
self.assertEqual(m.error_signature_streak, 1)
|
|
271
|
+
self.assertNotEqual(m.last_error_signature, "")
|
|
272
|
+
|
|
273
|
+
def test_declared_error_flag_beats_the_zero_exit_envelope(self):
|
|
274
|
+
m = proxy.SessionMonitor()
|
|
275
|
+
m.note_tool_result_error(DIFF_QUOTING_SOURCE, True, tool_names=["execute"])
|
|
276
|
+
self.assertEqual(m.error_signature_streak, 1)
|
|
277
|
+
|
|
278
|
+
|
|
228
279
|
class KnownFixCoverageTests(unittest.TestCase):
|
|
229
280
|
"""The uncovered ledger classes now carry a KNOWN FIX."""
|
|
230
281
|
|