gitshark

Clone repository

git clone https://gitshark.de/git/workaround/Gitshark.git
git clone git@gitshark.de:workaround/Gitshark.git

← Commits

✅ (mcp): Fix flaky addAndListIssueCommentTools (write/read race)

2cba53d5daa674f2eaecd0c0bfaa864b8cf5b712 · Michael Hainz · 2026-07-21T14:12:04Z

Changes

1 file changed, +6 -0

MODIFY src/test/java/de/workaround/mcp/McpToolsTest.java +6 -0
diff --git a/src/test/java/de/workaround/mcp/McpToolsTest.java b/src/test/java/de/workaround/mcp/McpToolsTest.java
index eed151e..e351520 100644
--- a/src/test/java/de/workaround/mcp/McpToolsTest.java
+++ b/src/test/java/de/workaround/mcp/McpToolsTest.java
@@ -138,12 +138,18 @@
138 138 .setAdditionalHeaders(json -> MultiMap.caseInsensitiveMultiMap().add("Authorization", "Bearer " + token))
139 139 .build().connect();
140 140
141 + // Add the comment and await its result before listing. Chaining both calls in one when() block
142 + // dispatches them concurrently (they land on different MCP worker threads), so the list can race
143 + // the add's commit and come back empty. A real MCP client calls sequentially — await, then list.
141 144 client.when()
142 145 .toolsCall("addIssueComment", Map.of("owner", owner.username, "name", "mcpissuecomments",
143 146 "number", issueNumber, "body", "first thought"), response -> {
144 147 assertFalse(response.isError());
145 148 assertTrue(response.firstContent().asText().text().contains("first thought"));
146 149 })
150 + .thenAssertResults();
151 +
152 + client.when()
147 153 .toolsCall("listIssueComments", Map.of("owner", owner.username, "name", "mcpissuecomments",
148 154 "number", issueNumber), response -> {
149 155 assertFalse(response.isError());

Keyboard shortcuts

?Show this help
g hGo home
EscClose dialog