Skip to content

test(telegram): avoid stale sockets in the model callback fixture - #143197

Merged
steipete merged 1 commit into
mainfrom
codex/telegram-loopback-fixture-close
Sep 9, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/telegram-loopback-fixture-close

Conversation

@steipete

@steipete steipete commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Related: #142242

What Problem This Solves

The model callback loopback test can report a failed model change even though persistence succeeds: cold model selection occupies the same process long enough for its fake Bot API server's idle socket timeout to race the next request. The success edit reuses that stale connection and receives ECONNRESET before reaching the server handler. This blocked CI for the separately reviewed manifest compression PR.

Why This Change Was Made

The local JSON response helper declares Connection: close, giving each fixture request its own completed connection lifecycle. This test covers callback authorization, opaque model resolution, persistence and response contents; persistent connection reuse is outside that contract.

User Impact

Production Telegram behavior is unchanged. The test continues to use real grammY and HTTP with the same assertions and deadlines.

Evidence

The unchanged case failed twice locally with the same visible failure as CI. Passive observation showed the success edit reusing a socket after a 6.83-second gap, then receiving ECONNRESET as the server's idle timeout fired; the fallback edit succeeded on a fresh socket.

The repaired case, model-button tests and real HTTP send siblings pass all 57 tests across three files. Independent P2 review reports no findings. Full changed-file checks passed. No retry, longer timeout or relaxed assertion is introduced.

@clawsweeper

clawsweeper Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: XS maintainer Maintainer-authored PR labels Sep 9, 2026
@steipete
steipete marked this pull request as ready for review September 9, 2026 14:53
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 9, 2026
@clawsweeper

clawsweeper Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 10:59 AM ET / 14:59 UTC.

ClawSweeper review

What this changes

The Telegram model-selection test closes each successful fixture HTTP response connection to prevent stale socket reuse during slow model selection.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a focused, useful fixture repair that is absent from inspected main and preserves the existing assertions. No actionable patch defect was found; the maintainer-authored, protected PR is not a cleanup candidate.

Priority: P3
Reviewed head: c87fa52fb44da626c7581cca402f99cac7257c82

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow fixture repair with a credible failure explanation, reported focused validation, and unchanged behavioral coverage.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR changes only the local HTTP fixture; its reported before/after socket observations and focused test results support that scope, and no production authority or Telegram-visible behavior changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR changes only the local HTTP fixture; its reported before/after socket observations and focused test results support that scope, and no production authority or Telegram-visible behavior changes.
Evidence reviewed 6 items Verified introduced change: The pinned merge-base-to-head diff changes only the local successful JSON response helper, adding Connection: close and an explanation; no production code, assertions, retries, or deadlines change.
Behavioral assertions remain intact: The test still requires the exact send/answer/edit request sequence, authorization-call ordering, persisted model override, and successful model-change text. Its client uses real grammY and an HTTP server bound to loopback.
Current main still lacks the repair: The fetched main revision retains the successful JSON response without Connection: close.
Findings None None.
Security None None.

How this fits together

The loopback fixture connects a real Telegram client to a local fake Bot API server. It exercises model callbacks through the production router and checks persisted selection and the resulting message edit.

flowchart LR
  A[Model selection button] --> B[Callback router]
  B --> C[Persist model selection]
  C --> D[Telegram HTTP client]
  D --> E[Local Bot API fixture]
  E --> F[JSON response and connection close]
  F --> G[Verify requests and session state]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +1. Total +1 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 2 1 +1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 2 1 +1

Review metrics

None.

Technical review

Best possible solution:

Keep socket lifecycle deterministic within this callback fixture while retaining real HTTP transport and all behavioral assertions.

Do we have a high-confidence way to reproduce the issue?

No independently established high-confidence reproduction: the body describes repeated failures and socket observations, but the timing-sensitive case was not executed during this read-only review.

Is this the best way to solve the issue?

Yes. Closing completed fixture connections removes an irrelevant keep-alive race without relaxing the callback, persistence, or response checks.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 81f1b2edf1f3.

Labels

Label justifications:

  • P3: This is a bounded test-fixture reliability repair with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR changes only the local HTTP fixture; its reported before/after socket observations and focused test results support that scope, and no production authority or Telegram-visible behavior changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 4d475f1 into main Sep 9, 2026
175 checks passed
@steipete
steipete deleted the codex/telegram-loopback-fixture-close branch September 9, 2026 15:15
@steipete

steipete commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 9, 2026
…er-ownership-20260909

* origin/main: (147 commits)
  fix(cli): reject blank account selectors before command startup (#143088)
  fix(update): repair young runs after recorded drivers exit (#143136)
  test(telegram): close model callback fixture connections (#143197)
  improve(test): reduce Telegram policy fixture startup overhead (#143192)
  test(ci): stabilize systemd manager shim timing (#143134)
  fix(test): retire chat preview Escape listeners during teardown (#143191)
  test(memory-wiki): share visibility test callbacks (#143181)
  fix(ci): accept native iOS keychain filenames (#142968)
  fix(ci): show publication observations in FRV status (#143171)
  fix(github): point the stuck-FAQ auto-response at a live anchor (#143194)
  docs: correct verified accuracy defects in CLI, tools, and automation pages (#143179)
  refactor(tests): remove duplicate Mistral cache-cost test (#143172)
  fix(doctor): complete canonical model-reference migration (#142284)
  fix(ci): reject stale and empty timing sample cohorts (#143182)
  fix(ui): remove first-reply confetti from chat (#143167)
  docs: split help/faq into 13 topic pages (#143150)
  refactor(docs): require caller-owned route indexes (#143164)
  fix(android): distinguish connection status from chat readiness (#143128)
  refactor: share agent-turn execution test defaults (#143166)
  fix(cli): print immutable-config refusals without crash framing (#143140)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant