Conversation
…ling) payload
Reproduced live 2026-09-14 on the operator's real running Sensei session
(tmux aoe_Turks_5588e698, still recurring in ~/scripts/master.log at the
moment this was diagnosed):
RUN: <arg_value>cd ~/scripts && gh pr list --state all --limit 10 2>&1
|| echo "GH CLI not available or not logged in"</arg_value>
The model emits a real colon-ed RUN directive, but wraps the ENTIRE
payload in its own <arg_value>...</arg_value> tags instead of trailing
them after real content.
_ARG_XML_TAG_RE's truncate-at-first-match logic (used in 3 places:
_extract_directive, _parse_read_target, and the session-summary save
path) was written assuming leaked XML tags always trail AFTER real
content ("truncate everything before the first tag, keep what's
before it") -- true for every previously-observed case. Here the
OPENING tag is the very first character of the payload, so truncating
"before the first tag" wiped the whole command to "". The directive
then silently vanished: RUN: already has a colon, so has_directives is
True, and the malformed-directive stall detector -- which only fires
when has_directives is False -- never got a chance to catch it and
trigger a repair. It just disappeared with no error, no retry, no
trace, other than the raw text getting shown to the user as if it were
the final answer.
Fix: added _strip_arg_xml_noise(), a shared helper next to
_ARG_XML_TAG_RE's definition, that distinguishes the two shapes by
checking whether the matched tag is an OPENING tag sitting at position
0 (wrapping shape -- strip the wrapper, keep the middle) vs. anything
else (trailing shape -- truncate before it, the original and still-
correct behavior). Replaced all 3 duplicated truncate-at-first-tag call
sites with calls to this one helper.
Added a regression test using tonight's exact live example, plus a
direct unit test of the helper covering both shapes. Verified via
py_compile and a targeted 10-test run covering this area (had to
work around a pre-existing, separately-noted environment bug: this
test file's own `sys.path.insert(0, "~/scripts")` shadows whichever
branch happens to be checked out in the shared main working directory,
so a naive `python3 -m unittest` run silently tests the wrong code --
forced the correct module into sys.modules by absolute path before
importing the test module to work around it for this verification).
No new failures beyond the pre-existing, unrelated live-network-
dependent tests already known to be flaky in this environment.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AYECZQGRJmdjYy89Eqtx89
|
@coderabbitai review |
|
Warning Review limit reachedNext included review available in 26 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Summary
RUN:/READ:/session-summary payload in<arg_value>...</arg_value>tags instead of trailing the tag after real content._ARG_XML_TAG_RE's truncate-at-first-match logic assumed leaked tags always trail after real content; when the opening tag is the very first character, that logic wiped the whole command to"", and sinceRUN:/READ:already have a colon, the malformed-directive stall detector (which only fires when no directive was recognized) never caught it — the directive silently vanished._strip_arg_xml_noise(), a shared helper that distinguishes wrapping vs. trailing shapes and handles both correctly. Replaced 3 duplicated call sites with it.Test plan
python3 -m py_compile master_ai.py test_master_ai_parser.py🤖 Generated with Claude Code