mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-27 21:44:25 -07:00
fix: reply in user's thread and prevent git credential hangs
Pass thread name through Add-ons response wrapper so bot replies stay in the user's thread instead of posting top-level messages. Add GIT_TERMINAL_PROMPT=0 to Dockerfile to prevent git from hanging on credential prompts, which was blocking all requests under concurrency=1.
This commit is contained in:
@@ -22,6 +22,9 @@ USER node
|
|||||||
ENV CODER_AGENT_WORKSPACE_PATH=/workspace
|
ENV CODER_AGENT_WORKSPACE_PATH=/workspace
|
||||||
ENV CODER_AGENT_PORT=8080
|
ENV CODER_AGENT_PORT=8080
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
# Prevent git from prompting for credentials interactively — fails fast instead of hanging
|
||||||
|
ENV GIT_TERMINAL_PROMPT=0
|
||||||
|
ENV CODER_AGENT_HOST=0.0.0.0
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export class ChatBridgeHandler {
|
|||||||
this.sessionStore.updateTaskId(threadName, newTaskId);
|
this.sessionStore.updateTaskId(threadName, newTaskId);
|
||||||
|
|
||||||
const threadKey = message.thread.threadKey || threadName;
|
const threadKey = message.thread.threadKey || threadName;
|
||||||
return renderResponse(response, threadKey);
|
return renderResponse(response, threadKey, threadName);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorMsg =
|
const errorMsg =
|
||||||
error instanceof Error ? error.message : 'Unknown error';
|
error instanceof Error ? error.message : 'Unknown error';
|
||||||
@@ -205,7 +205,7 @@ export class ChatBridgeHandler {
|
|||||||
|
|
||||||
// Convert A2A response to Chat format
|
// Convert A2A response to Chat format
|
||||||
const threadKey = message.thread.threadKey || threadName;
|
const threadKey = message.thread.threadKey || threadName;
|
||||||
return renderResponse(response, threadKey);
|
return renderResponse(response, threadKey, threadName);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorMsg = error instanceof Error ? error.message : 'Unknown error';
|
const errorMsg = error instanceof Error ? error.message : 'Unknown error';
|
||||||
logger.error(`[ChatBridge] Error handling message: ${errorMsg}`, error);
|
logger.error(`[ChatBridge] Error handling message: ${errorMsg}`, error);
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ export function extractToolApprovals(
|
|||||||
export function renderResponse(
|
export function renderResponse(
|
||||||
response: A2AResponse,
|
response: A2AResponse,
|
||||||
threadKey?: string,
|
threadKey?: string,
|
||||||
|
threadName?: string,
|
||||||
): ChatResponse {
|
): ChatResponse {
|
||||||
const parts = extractAllParts(response);
|
const parts = extractAllParts(response);
|
||||||
const textContent = extractTextFromParts(parts);
|
const textContent = extractTextFromParts(parts);
|
||||||
@@ -145,8 +146,10 @@ export function renderResponse(
|
|||||||
chatResponse.cardsV2 = cards;
|
chatResponse.cardsV2 = cards;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (threadKey) {
|
if (threadKey || threadName) {
|
||||||
chatResponse.thread = { threadKey };
|
chatResponse.thread = {};
|
||||||
|
if (threadKey) chatResponse.thread.threadKey = threadKey;
|
||||||
|
if (threadName) chatResponse.thread.name = threadName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we always return something
|
// Ensure we always return something
|
||||||
|
|||||||
@@ -253,6 +253,15 @@ function wrapAddOnsResponse(response: ChatResponse): Record<string, unknown> {
|
|||||||
if (response.cardsV2) {
|
if (response.cardsV2) {
|
||||||
message['cardsV2'] = response.cardsV2;
|
message['cardsV2'] = response.cardsV2;
|
||||||
}
|
}
|
||||||
|
// Include thread info so the reply goes to the user's thread
|
||||||
|
// instead of appearing as a top-level message
|
||||||
|
if (response.thread) {
|
||||||
|
const thread: Record<string, string> = {};
|
||||||
|
if (response.thread.name) thread['name'] = response.thread.name;
|
||||||
|
if (response.thread.threadKey)
|
||||||
|
thread['threadKey'] = response.thread.threadKey;
|
||||||
|
message['thread'] = thread;
|
||||||
|
}
|
||||||
|
|
||||||
// For action responses (like CARD_CLICKED acknowledgments), use updateMessageAction
|
// For action responses (like CARD_CLICKED acknowledgments), use updateMessageAction
|
||||||
if (response.actionResponse?.type === 'UPDATE_MESSAGE') {
|
if (response.actionResponse?.type === 'UPDATE_MESSAGE') {
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export interface ChatOnClick {
|
|||||||
export interface ChatResponse {
|
export interface ChatResponse {
|
||||||
text?: string;
|
text?: string;
|
||||||
cardsV2?: ChatCardV2[];
|
cardsV2?: ChatCardV2[];
|
||||||
thread?: { threadKey: string };
|
thread?: { threadKey?: string; name?: string };
|
||||||
actionResponse?: {
|
actionResponse?: {
|
||||||
type: 'NEW_MESSAGE' | 'UPDATE_MESSAGE' | 'REQUEST_CONFIG';
|
type: 'NEW_MESSAGE' | 'UPDATE_MESSAGE' | 'REQUEST_CONFIG';
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user