While running a long-lived OmegaClaw agent (deepseek-chat-v3-0324 via OpenRouter, temperature 0.1), we traced silent reply failures to balance_parentheses in src/helper.py transforming well-formed model output into unparseable forms.
Repro (observed live, raw output logged before/after):
Model emitted (note: one stray trailing paren, otherwise clean):
((send "Understood. Let me know how I can assist once the chat box is fully operational.")))
After balance_parentheses:
(((send "\"Understood. Let me know how I can assist once the chat box is fully operational.\")"))
— an extra paren layer is added at the front and the quotes are converted to escaped form, so sread fails and the reply is lost. The same transformation reproduced on multiple well-formed sends across different sessions. PR #301 does not address this path (it handles unknown head tokens, not quote handling on known commands).
Second, related behavior: when the model answers a human message in plain prose (no command form at all), balance_parentheses wraps the prose's first word into a pseudo-command, e.g.:
It looks like your message came through...
becomes
((It "looks like your message came through..."))
which then executes as an unknown skill. Between these two behaviors, a model that is answering correctly in substance can fail to deliver anything for many consecutive turns — which presents to the operator as the "agent goes silent / no_action loop" symptom class (#311/#314 reports mention similar surface symptoms).
Mitigation we run locally: a pre-parse canonicalizer — if the raw output matches a single clean quoted command (send/remember/query/pin) with only paren-count noise, rebuild the canonical ((cmd "text")) from the raw match before the balancer result is used; and prose answers to a fresh human message are delivered verbatim as a send instead of being minted into pseudo-commands. Happy to share the implementation if useful.
While running a long-lived OmegaClaw agent (deepseek-chat-v3-0324 via OpenRouter, temperature 0.1), we traced silent reply failures to
balance_parenthesesinsrc/helper.pytransforming well-formed model output into unparseable forms.Repro (observed live, raw output logged before/after):
Model emitted (note: one stray trailing paren, otherwise clean):
After
balance_parentheses:— an extra paren layer is added at the front and the quotes are converted to escaped form, so
sreadfails and the reply is lost. The same transformation reproduced on multiple well-formed sends across different sessions. PR #301 does not address this path (it handles unknown head tokens, not quote handling on known commands).Second, related behavior: when the model answers a human message in plain prose (no command form at all),
balance_parentheseswraps the prose's first word into a pseudo-command, e.g.:becomes
which then executes as an unknown skill. Between these two behaviors, a model that is answering correctly in substance can fail to deliver anything for many consecutive turns — which presents to the operator as the "agent goes silent / no_action loop" symptom class (#311/#314 reports mention similar surface symptoms).
Mitigation we run locally: a pre-parse canonicalizer — if the raw output matches a single clean quoted command (
send/remember/query/pin) with only paren-count noise, rebuild the canonical((cmd "text"))from the raw match before the balancer result is used; and prose answers to a fresh human message are delivered verbatim as asendinstead of being minted into pseudo-commands. Happy to share the implementation if useful.