Repository navigation
test(telegram): avoid stale sockets in the model callback fixture - #143197
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 10:59 AM ET / 14:59 UTC. ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherThe 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +1. Total +1 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…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) ...
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
ECONNRESETbefore 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
ECONNRESETas 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.