fix: keep bounded event consume runs alive after stdin EOF#1285
fix: keep bounded event consume runs alive after stdin EOF#1285Emrys1105 wants to merge 6 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR refines stdin EOF shutdown behavior for the ChangesConditional stdin EOF watching for bounded event consumption runs
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@57ee10e92382ed085348c15cf362685446450b46🧩 Skill updatenpx skills add larksuite/cli#fix/event-consume-stdin-eof -y -g |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1285 +/- ##
==========================================
+ Coverage 69.17% 70.17% +1.00%
==========================================
Files 630 671 +41
Lines 59380 65334 +5954
==========================================
+ Hits 41075 45850 +4775
- Misses 14996 15795 +799
- Partials 3309 3689 +380 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
event consumearmed its stdin-EOF shutdown watcher for every non-TTY session, so subprocess callers whose stdin is/dev/null(OpenCode, CI,bash -c) were cancelled at startup withError: context canceled— even when--max-events/--timeoutexplicitly declared the run's lifecycle (#1131). This PR gates the watcher to non-TTY unbounded runs only, so bounded runs exit via their own bound, timeout, or SIGTERM. Supersedes #1183 (cherry-picked with author attribution preserved) and adds the documentation/contract sync it lacked.Changes
shouldWatchStdinEOF(non-TTY &&maxEvents <= 0&&timeout <= 0) incmd/event/consume.go— cherry-picked from fix(event): keep bounded consume alive after stdin EOF #1183 (author @jinhyuk9714)TestShouldWatchStdinEOFwith combined / mixed-sign bound cases incmd/event/consume_stdin_test.go(9 cases total)internal/event/consume/consume.go, with tests ininternal/event/consume/listening_text_test.goskills/lark-event/SKILL.md: bounded-run stdin-EOF exemption, exit-reason table note, and description routing (staticevent schemalookup,--as botidentity)--max-events/--timeoutflag help incmd/event/consume.goBehavior change: a bounded run no longer stops early when a piped stdin closes — it exits only via its bound, timeout, or SIGTERM. Residual (accepted): unbounded runs over
/dev/nullkeep the documented legacy instant graceful exit (reason: signal); under a cold-start race this can surface as exit 1context canceled(pre-existing, out of scope).Test Plan
make unit-testpassed (full unit + integration suite, via harness validate)lark-cli event consume im.message.receive_v1 --as bot --max-events 1 --timeout 10m < /dev/nullin the sandbox container — stayed alive 5m07s on/dev/nullstdin, received 1 real IM event, exited 0 withreason: limitRelated Issues
Closes #1131
Supersedes #1183 (commits cherry-picked with original authorship preserved).
Summary by CodeRabbit
Documentation
--max-eventshelp text to clarify how stdin-EOF shutdown behaves for bounded runs.Improvements