Open
Conversation
|
This might be the same as #99 - no opinion on which fix is better! |
Author
|
I compared both PRs.
What they both fix:
PR #99:
PR #101:
Recommendation:
|
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.
Closes #100
Summary
This PR fixes the real root cause behind OpenCode timing out when
codebase-memory-mcpis used directly, without the wrapper.The issue was in the MCP stdio event loop. The server mixed raw file descriptor polling with buffered
FILE *reads, which can stall when stdio has already pre-buffered incoming bytes. That caused OpenCode to time out during MCP tool discovery.What changed
Content-Lengthframed messagesWhy this fixes OpenCode
OpenCode depends on a stable MCP stdio handshake during tool resolution.
Before this change, the server could block waiting on raw-fd readiness even though the next message had already been buffered by stdio. That made tool discovery hang until OpenCode timed out.
After this change, parsing is driven consistently from the stdio stream itself, so pre-buffered messages are consumed correctly and the handshake completes.
Validation
Repository checks:
scripts/test.shscripts/lint.shBehavioral validation:
list_projectsworked from OpenCodeScope
This PR intentionally focuses only on the actual transport-layer root cause for the OpenCode timeout, without bundling unrelated MCP changes.