Skip to content

Fix 5th malformed-directive shape: <arg_value>-wrapped RUN/READ payload - #5

Open
ebey317 wants to merge 1 commit into
feat/splash-update-checkfrom
fix/arg-xml-wrapper-shape
Open

ebey317 wants to merge 1 commit into
feat/splash-update-checkfrom
fix/arg-xml-wrapper-shape

Conversation

@ebey317

@ebey317 ebey317 commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Reproduced live 2026-09-14 on the operator's real running Sensei session (recurring at time of diagnosis): a model wraps an ENTIRE 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 since RUN:/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.
  • Added _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
  • Targeted 10-test run covering this area, including a new regression test using tonight's exact live example, plus a direct unit test of the helper — all pass
  • Awaiting CodeRabbit + no-mistakes review per standing project practice

🤖 Generated with Claude Code

…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
@ebey317

ebey317 commented Sep 14, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: be96e8d7-d884-434b-bed1-6543c1986085

📥 Commits

Reviewing files that changed from the base of the PR and between 577b838 and 4ca2685.

📒 Files selected for processing (2)
  • master_ai.py
  • test_master_ai_parser.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant