mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 04:30:48 +00:00
feat(arena): forward chat history to spawned agents
Add stripStartupContext to remove env-info from parent history and pass chatHistory through ArenaManager → InProcessBackend → AgentInteractive → AgentCore. This allows arena agents to start with conversational context from the main session. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
89f8751233
commit
9f7e3e054f
15 changed files with 249 additions and 2 deletions
|
|
@ -21,6 +21,7 @@ import {
|
|||
ArenaSessionStatus,
|
||||
AuthType,
|
||||
createDebugLogger,
|
||||
stripStartupContext,
|
||||
type Config,
|
||||
type ArenaModelConfig,
|
||||
type ArenaAgentErrorEvent,
|
||||
|
|
@ -171,6 +172,18 @@ function executeArenaCommand(
|
|||
ui: CommandContext['ui'],
|
||||
input: ArenaExecutionInput,
|
||||
): void {
|
||||
// Capture the main session's chat history so arena agents start with
|
||||
// conversational context. Strip the leading startup context (env info
|
||||
// user message + model ack) because each agent generates its own for
|
||||
// its worktree directory — keeping the parent's would duplicate it.
|
||||
let chatHistory;
|
||||
try {
|
||||
const fullHistory = config.getGeminiClient().getHistory();
|
||||
chatHistory = stripStartupContext(fullHistory);
|
||||
} catch {
|
||||
debugLogger.debug('Could not retrieve chat history for arena agents');
|
||||
}
|
||||
|
||||
const manager = new ArenaManager(config);
|
||||
const emitter = manager.getEventEmitter();
|
||||
const detachListeners: Array<() => void> = [];
|
||||
|
|
@ -331,6 +344,7 @@ function executeArenaCommand(
|
|||
cols,
|
||||
rows,
|
||||
approvalMode: input.approvalMode,
|
||||
chatHistory,
|
||||
})
|
||||
.then(
|
||||
() => {
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ export const AgentChatView = ({ agentId }: AgentChatViewProps) => {
|
|||
),
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[
|
||||
agentId,
|
||||
messages.length,
|
||||
pendingApprovals?.size,
|
||||
liveOutputs?.size,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue