fix: bound publish_interaction so a hung Windows backend can't freeze the SessionStart hook#117
Conversation
…eze the hook Client-side containment for the Windows publish hang (ReflexioAI/reflexio root cause). Refs ReflexioAI#109
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdapter.publish now runs client.publish_interaction in a background daemon thread with a wall-clock join timeout and returns False on timeout instead of blocking indefinitely. A regression test covers the hanging-client case. ChangesPublish Timeout Enforcement
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant AdapterPublish as Adapter.publish
participant Thread as Daemon Thread
participant Client as Reflexio Client
Caller->>AdapterPublish: publish(kwargs)
AdapterPublish->>Thread: start(client.publish_interaction, kwargs)
AdapterPublish->>Thread: join(_PUBLISH_WALL_TIMEOUT_SECONDS)
alt Thread finishes in time
Thread->>Client: publish_interaction(**kwargs)
Thread-->>AdapterPublish: success flag
AdapterPublish-->>Caller: return success
else Thread still alive after timeout
AdapterPublish-->>Caller: log warning, return False
end
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@plugin/src/claude_smart/reflexio_adapter.py`:
- Around line 130-146: The exception handling around publish_interaction is no
longer covering failures once _do_publish runs in the background thread. Update
the Reflexio adapter’s _do_publish helper in reflexio_adapter.py to catch
exceptions from client.publish_interaction(**kwargs) inside the worker thread,
log or record the failure, and ensure the thread cannot emit an unhandled
traceback; keep the worker/thread timeout behavior and only set result["ok"]
after a successful publish.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4898f321-6742-4c56-a7fd-cb1b894a74e7
📒 Files selected for processing (2)
plugin/src/claude_smart/reflexio_adapter.pytests/test_adapter.py
fix: contain publish exceptions raised inside the worker thread The wall-clock guard ran publish_interaction in a background thread, but the outer try/except cannot catch exceptions raised there — a connection failure emitted an unhandled thread traceback instead of being contained. Capture the exception in the worker, then surface it as a warning + False after join. Addresses CodeRabbit review on ReflexioAI#117. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> @
|
Thanks for the review — addressed in |
Containment for #109 (root cause tracked in ReflexioAI/reflexio: ReflexioAI/reflexio#295). Runs the publish under an 8s wall-clock cap; on timeout returns False and the unpublished buffer retries next turn. Refs #109.
Summary by CodeRabbit
publishnow enforces a short wall-clock timeout for send operations, so the app won’t hang if delivery stalls.