fix(opencode): Add a poller to opencode CLI inbox delivery to drain s…#210
Merged
haofeif merged 6 commits intoApr 29, 2026
Merged
Conversation
…tuck messages in pending status
Collaborator
Author
|
todo -
|
Collaborator
Author
|
Manual OpenCode smoke test completed. The OpenCode polling fix is working. Tested with all agent profiles running on DeepSeek V4 Flash.
Key fix validation: Dataset B and Dataset C messages initially appeared as pending inbox rows, then the OpenCode polling fallback delivered them to the supervisor successfully. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #210 +/- ##
=======================================
Coverage ? 92.49%
=======================================
Files ? 60
Lines ? 4994
Branches ? 0
=======================================
Hits ? 4619
Misses ? 375
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds a temporary OpenCode-specific inbox delivery poller to prevent
opencode_cliassign/send_message callbacks from getting stuck inpendingafter the supervisor TUI settles.OpenCode can become idle without emitting another
pipe-panelog update, so the existing watchdog-backedLogFileHandlermay never get a file-modified event to re-check pending inbox messages. This change keeps the existing immediate-delivery and watchdog paths unchanged, but adds a small pending-message-driven fallback for OpenCode only: every inbox polling interval, the server finds OpenCode terminals with pending inbox messages and reuses the existingcheck_and_send_pending_messages()delivery helper.Addresses Issue #203.
This is intentionally scoped as a stopgap. It documents and accepts the existing duplicate-wakeup race between immediate delivery, watchdog delivery, and this poller; PR #115 should replace these paths with a single coordinated delivery engine.
Key Changes
src/cli_agent_orchestrator/clients/database.pylist_pending_receiver_ids_by_provider()to query distinct receiver terminal IDs with pending inbox messages for a specific providersrc/cli_agent_orchestrator/services/inbox_service.pypoll_opencode_pending_messages()which scans pendingopencode_clireceivers and calls the existing delivery helper per receiversrc/cli_agent_orchestrator/api/main.pyopencode_inbox_delivery_daemon()alongside the existing flow daemon and watchdog observertest/clients/test_database.pytest/services/test_inbox_service.pytest/api/test_api_endpoints.pyTest Plan
uv run --group dev python -m black src/cli_agent_orchestrator/api/main.py src/cli_agent_orchestrator/clients/database.py src/cli_agent_orchestrator/services/inbox_service.py test/api/test_api_endpoints.py test/clients/test_database.py test/services/test_inbox_service.pyuv run --group dev pytest test/services/test_inbox_service.py test/clients/test_database.py test/api/test_api_endpoints.py::TestOpenCodeInboxDeliveryDaemon test/api/test_api_endpoints.py::TestLifespan -q—47 passedgit diff --checkcao-server, installedanalysis_supervisor,data_analyst,report_generator, anddeveloperforopencode_cli, then ranuv run --group dev pytest -m e2e test/e2e/test_assign.py::TestOpenCodeCliAssign::test_assign_with_callback -v -s—1 passed in 62.41suv run --group dev pytest -m e2e test/e2e/test_assign.py::TestOpenCodeCliAssign::test_assign_data_analyst test/e2e/test_assign.py::TestOpenCodeCliAssign::test_assign_report_generator -v -s—2 passed in 114.04s