fix(telegram): classify bare pre-connect grammY errors as recoverable for send context#80367
fix(telegram): classify bare pre-connect grammY errors as recoverable for send context#80367hclsys wants to merge 4 commits into
Conversation
Top-level `think` causes 400 for non-thinking Ollama models; placing it inside `options.think` is accepted by every model while still controlling reasoning budget on thinking-capable models. - createOllamaThinkingWrapper: patch options.think instead of payloadRecord.think - resolveOllamaModelOptions: include think from params in options block - resolveOllamaTopLevelParams: remove think (no longer a top-level param) - Update 6 tests to assert options.think placement Fixes openclaw#80332
`sessions --json` projected through `SessionDisplayRow` which omitted `spawnedBy`, `sessionFile`, `label`, `status`, `spawnDepth`, `sessionStartedAt`, `lastInteractionAt`, `startedAt`, `endedAt`, and `runtimeMs` — all present in the underlying `SessionEntry` store. Read-only consumers (lineage detectors, governance audits, fleet observability) couldn't distinguish subagent sessions or compute lineage coverage from the supported CLI surface. Fixes openclaw#80286. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… for send context grammY raises two distinct network error forms: - Post-connect: "Network request for 'X' failed after N attempts." — grammy's own retry budget exhausted; may have reached Telegram. Risky to retry. - Pre-connect: "Network request for 'X' failed!" — socket dropped before bytes hit the wire; message was never delivered. Safe to retry. The existing GRAMMY_NETWORK_REQUEST_FAILED_AFTER_RE regex only matches the post-connect form. For context "send", allowMessageMatch=false blocks the RECOVERABLE_MESSAGE_SNIPPETS path that would otherwise catch the pre-connect form, leaving it unclassified → shouldRetry returns false → reply dropped. Add GRAMMY_NETWORK_REQUEST_FAILED_BARE_RE for the pre-connect form and check it unconditionally (before the allowMessageMatch gate) so send-context calls treat pre-connect failures as recoverable. Non-grammy snippet matches (e.g. "undici") remain blocked for send context. Fixes openclaw#80362 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: no. high-confidence live reproduction is present. Source inspection does show current main returns false for the bare send-context message targeted by the PR, but the real Telegram transport failure path is not proven. Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Keep the Telegram fix focused on nested pre-connect evidence, split unrelated Ollama and sessions work into separate PRs, and require redacted live Telegram transport proof before merge. Do we have a high-confidence way to reproduce the issue? No high-confidence live reproduction is present. Source inspection does show current main returns false for the bare send-context message targeted by the PR, but the real Telegram transport failure path is not proven. Is this the best way to solve the issue? No, not as submitted. The safer solution is a Telegram-only patch that ties retry eligibility to nested pre-connect evidence rather than the outer grammY envelope alone. Full review comments:
Overall correctness: patch is incorrect What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 4ad9286e19f4. Re-review progress:
|
Closes #80362
Summary
isRecoverableTelegramNetworkErrorwas returningfalsefor bare pre-connect grammY errors ("Network request for 'sendMessage' failed!"— no"after"suffix) whencontext: "send"was passed, causing the bot to silently drop messages instead of retrying. Bare pre-connect errors occur before any bytes reach the Telegram server, making them safe to retry for all contexts including send.Root cause: The existing
GRAMMY_NETWORK_REQUEST_FAILED_REmatched the"failed! After N tries..."form, not the bare"failed!"form. The send-context guard inisRecoverableTelegramNetworkErrorchecked only the "after" variant, so bare socket-drop errors were not classified as safe to retry.Changes
extensions/telegram/src/network-errors.ts: AddGRAMMY_NETWORK_REQUEST_FAILED_BARE_REto match bare pre-connect form; check it inisRecoverableTelegramNetworkErrorbefore the send-context rejection guard.extensions/telegram/src/network-errors.test.ts: 2 new tests for bare pre-connect classification and non-grammY snippet rejection for send context.extensions/ollama/src/stream.ts+ test: routethinkparameter throughoptionsblock (independent fix on same branch).src/commands/sessions-table.ts: expose subagent runtime metadata fields in--json(independent fix on same branch).Real Behavior Proof
Behavior or issue addressed:
isRecoverableTelegramNetworkError(new Error("Network request for 'sendMessage' failed!"), { context: "send" })returnedfalse(reply dropped). Now returnstrue(retry triggered).Real environment tested: Node.js v22.22.0, tsx/esm TypeScript loader, branch
fix/telegram-bare-network-error-retry-80362, Linux.Exact steps or command run after this patch:
Evidence after fix:
Bare pre-connect grammY errors now return
truefor send context. Non-grammY snippets (e.g. "undici") remain blocked.Observed result after fix:
isRecoverableTelegramNetworkError(new Error("Network request for 'sendMessage' failed!"), { context: "send" })now returnstrue. Messages that previously dropped silently on socket-close-before-send will be retried. Non-grammY network errors remain non-recoverable for send context.What was not tested: Live Telegram integration with actual dropped connections (no Telegram test account available on test host).