ammachado commented on code in PR #24594:
URL: https://github.com/apache/camel/pull/24594#discussion_r3564655968
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanel.java:
##########
@@ -83,21 +94,37 @@ record LogEntry(String timestamp, LogLevel level, String
message, String detail)
private final StringBuilder inputBuffer = new StringBuilder();
private int cursorPos;
- // Conversation display
+ // Conversation display. CopyOnWriteArrayList because entries are appended
from the agent thread and the
+ // CLI-command-completion callback while the render thread iterates the
list concurrently.
private final List<ConversationEntry> conversation = new
CopyOnWriteArrayList<>();
private int scrollOffset;
// LLM state
- private LlmClient client;
+ private volatile LlmClient client;
private List<LlmClient.Message> messages;
private List<LlmClient.ToolDef> tools;
private AskTools askTools;
private final AtomicBoolean thinking = new AtomicBoolean();
private volatile Thread agentThread;
private String initError;
private long thinkingStartTime;
+ private String thinkingVerb;
private volatile int sessionTotalTokens;
Review Comment:
Fixed in ae38606cb33372c942a01f763da8397f7252668b — `thinkingVerb` is now
`volatile` so its value is visible across the UI thread and the CLI completion
callback thread.
_Claude Code on behalf of ammachado_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]