fix(matrix): preserve controls during command batching - #58591
Conversation
Competing with #58565 for the same fix (#58559). #58565 is the narrower/earlier PR (touches |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for extending the Matrix fix through the runner-level active-session path. The underlying gaps are present on current main: Matrix batches only MessageType.TEXT at plugins/platforms/matrix/adapter.py:2785, and dynamic commands are absent from the running-agent resolve_command() path at gateway/run.py:9350 and :9598.
Problems
plugins/platforms/matrix/adapter.py:2793makes any short command received after a buffered long command into a continuation. Since_enqueue_text_event()appends incoming text to the pending event (plugins/platforms/matrix/adapter.py:3469-3473), a genuine/stopor/newduring that debounce window is swallowed into the long command rather than dispatched.
Suggested changes
- Preserve immediate handling for recognized built-in, plugin, and skill commands while retaining batching for unknown command-like continuation text. Add a regression case for a long buffered command followed by
/stopor/new.
Automated hermes-sweeper review.
…commands Matrix bang commands that normalize to /command are MessageType.COMMAND, which skipped the text-batching buffer. Long commands near _SPLIT_THRESHOLD now go through batching so continuation chunks are aggregated. Skill commands (e.g. /arxiv) are resolved through a separate registry and were not recognized by should_bypass_active_session(), causing them to be queued as user text instead of dispatched directly. Fixes NousResearch#58559
16e33c0 to
f3babd2
Compare
What does this PR do?
Fixes Matrix long-command batching without allowing a following recognized command to be swallowed into the pending batch.
This draft:
The first commit preserves the original authorship and patch from @liuhao1024's #58565. The second commit contains the additional runner, continuation-ordering, profile-safety, and auto-thread corrections required by the end-to-end regressions and review.
Fixes #58559.
Why?
Matrix clients can split long
!commandmessages near their message-size limit. The initial command must wait briefly for continuation text, but real control/plugin/skill commands arriving during that window must retain their normal immediate routing. Recognition also has to use the routed profile and the same thread identity that the adapter assigns to the synthetic continuation.Validation
scripts/run_tests.shfocused and sibling suites: 407 passedpython3 scripts/check-windows-footguns.py ...: passedgit diff --check: passedf3babd2f6735e5e6d5eebe79f2b78573cd7b4ed6: PASSThe required full-suite wrapper was attempted once on an earlier candidate and reached about 640 passing tests with no observed failure before its detached process tree was stopped. That incomplete run is not claimed as a full-suite pass. The final simplified tree was validated with the focused and sibling suites above and will be validated by live CI.
Scope and compatibility
No new public API, dependency, configuration, or general command framework is introduced. The change preserves both gateway active-message guards, Matrix mention/auto-thread behavior, profile boundaries, and cross-platform Python behavior.
This PR remains a draft pending live CI and post-draft review.