Skip to content

Relay Hub answer and reasoning delta frames before answer_done - #629

Closed
pmanko wants to merge 3 commits into
mainfrom
hub-answer-delta-relay
Closed

pmanko wants to merge 3 commits into
mainfrom
hub-answer-delta-relay

Conversation

@pmanko

@pmanko pmanko commented Nov 3, 2026

Copy link
Copy Markdown
Member

Relays reasoning_delta and answer_delta SSE frames from med-agent-hub onto TurnEvent.delta(...) prior to answer_done and advertises ProviderCapability.TOKEN_STREAMING on HubClinicalAnswerProvider.

@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change reaches the Hub-backed chart-answer streaming workflow.

The production change appears sound, but the new test must satisfy the repository’s testing requirement before merging.

Fix All in Claude CodeFindings

  1. P2 Test skips the real transport ▶
Fix with agent prompt
### Issue 1
api/src/test/java/org/openmrs/module/chartsearchai/api/provider/HubClinicalAnswerProviderTest.java:383-393
The new test replays hand-built events through `ScriptedHubTransport`. `CLAUDE.md` requires tests to exercise the full production path with real data and forbids simulations or mocks. By skipping `HttpHubStreamTransport`, this test cannot catch a mismatch between actual SSE frames and the assumed `delta` payload. Add coverage through the production transport and required real-data path before merging.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

  • Hub turns show reasoning and answer text before the full answer arrives.

Reviews (1) · Last reviewed commit: "Relay Hub answer and reasoning delta fra..." · Reviewed by Greptile

Comment on lines +383 to +393
ScriptedHubTransport transport = new ScriptedHubTransport();
Map<String, Object> answer = answerPayload("Aspirin 81mg.");
Map<String, Object> done = new LinkedHashMap<>(answer);
done.put("answerValidation", Collections.singletonMap("status", "checked"));
transport.events = Arrays.asList(
wire("reasoning_delta", Collections.singletonMap("delta", "Checking medication list. ")),
wire("answer_delta", Collections.singletonMap("delta", "Aspirin ")),
wire("answer_delta", Collections.singletonMap("delta", "81mg.")),
wire("answer_done", answer),
wire("answer_delta", Collections.singletonMap("delta", "late delta ignored")),
wire("done", done));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Test skips the real transport

The new test replays hand-built events through ScriptedHubTransport. CLAUDE.md requires tests to exercise the full production path with real data and forbids simulations or mocks. By skipping HttpHubStreamTransport, this test cannot catch a mismatch between actual SSE frames and the assumed delta payload. Add coverage through the production transport and required real-data path before merging.

Context Used: CLAUDE.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: api/src/test/java/org/openmrs/module/chartsearchai/api/provider/HubClinicalAnswerProviderTest.java
Line: 383-393

Comment:
**Test skips the real transport**

The new test replays hand-built events through `ScriptedHubTransport`. `CLAUDE.md` requires tests to exercise the full production path with real data and forbids simulations or mocks. By skipping `HttpHubStreamTransport`, this test cannot catch a mismatch between actual SSE frames and the assumed `delta` payload. Add coverage through the production transport and required real-data path before merging.

**Context Used:** CLAUDE.md ([source](https://github.com/openmrs/openmrs-module-chartsearchai/blob/main/CLAUDE.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex

@pmanko

pmanko commented Nov 15, 2026

Copy link
Copy Markdown
Member Author

Superseded by #630, which combines server-side default Hub preset resolution with ephemeral /chat/stream support.

@pmanko pmanko closed this Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant