fix(agent): code format fixed

This commit is contained in:
sky5454 2026-04-19 09:14:27 +08:00
parent b1d947e337
commit 11f9d962ea
7 changed files with 10 additions and 13 deletions

View file

@ -37,4 +37,4 @@ func NewPipeline(al *AgentLoop) *Pipeline {
Steering: al.steering, Steering: al.steering,
al: al, al: al,
} }
} }

View file

@ -629,9 +629,9 @@ toolLoop:
if len(exec.pendingMessages) > 0 { if len(exec.pendingMessages) > 0 {
logger.InfoCF("agent", "Pending steering after partial tool execution; continuing turn", logger.InfoCF("agent", "Pending steering after partial tool execution; continuing turn",
map[string]any{ map[string]any{
"agent_id": ts.agent.ID, "agent_id": ts.agent.ID,
"pending_count": len(exec.pendingMessages), "pending_count": len(exec.pendingMessages),
"allResponsesHandled": exec.allResponsesHandled, "allResponsesHandled": exec.allResponsesHandled,
}) })
return ToolControlContinue return ToolControlContinue
} }
@ -691,4 +691,4 @@ toolLoop:
"agent_id": ts.agent.ID, "iteration": iteration, "agent_id": ts.agent.ID, "iteration": iteration,
}) })
return ToolControlContinue return ToolControlContinue
} }

View file

@ -27,7 +27,6 @@ func (p *Pipeline) Finalize(
// But still check for hard abort - if requested, abort the turn. // But still check for hard abort - if requested, abort the turn.
if exec.allResponsesHandled { if exec.allResponsesHandled {
if ts.hardAbortRequested() { if ts.hardAbortRequested() {
turnStatus = TurnEndStatusAborted
return al.abortTurn(ts) return al.abortTurn(ts)
} }
ts.setPhase(TurnPhaseCompleted) ts.setPhase(TurnPhaseCompleted)
@ -46,7 +45,6 @@ func (p *Pipeline) Finalize(
ts.recordPersistedMessage(finalMsg) ts.recordPersistedMessage(finalMsg)
ts.ingestMessage(turnCtx, al, finalMsg) ts.ingestMessage(turnCtx, al, finalMsg)
if err := ts.agent.Sessions.Save(ts.sessionKey); err != nil { if err := ts.agent.Sessions.Save(ts.sessionKey); err != nil {
turnStatus = TurnEndStatusError
al.emitEvent( al.emitEvent(
EventKindError, EventKindError,
ts.eventMeta("runTurn", "turn.error"), ts.eventMeta("runTurn", "turn.error"),
@ -55,7 +53,7 @@ func (p *Pipeline) Finalize(
Message: err.Error(), Message: err.Error(),
}, },
) )
return turnResult{}, err return turnResult{status: TurnEndStatusError}, err
} }
} }
@ -76,4 +74,4 @@ func (p *Pipeline) Finalize(
status: turnStatus, status: turnStatus,
followUps: append([]bus.InboundMessage(nil), ts.followUps...), followUps: append([]bus.InboundMessage(nil), ts.followUps...),
}, nil }, nil
} }

View file

@ -517,4 +517,4 @@ func (p *Pipeline) CallLLM(
} }
return ControlToolLoop, nil return ControlToolLoop, nil
} }

View file

@ -113,4 +113,4 @@ func (p *Pipeline) SetupTurn(ctx context.Context, ts *turnState) (*turnExecution
exec.usedLight = usedLight exec.usedLight = usedLight
return exec, nil return exec, nil
} }

View file

@ -204,7 +204,6 @@ func (al *AgentLoop) runTurn(ctx context.Context, ts *turnState, pipeline *Pipel
return pipeline.Finalize(ctx, turnCtx, ts, exec, turnStatus, finalContent) return pipeline.Finalize(ctx, turnCtx, ts, exec, turnStatus, finalContent)
} }
} }
} }
if ts.hardAbortRequested() { if ts.hardAbortRequested() {

View file

@ -642,4 +642,4 @@ func turnStateFromContext(ctx context.Context) *turnState {
// TurnStateFromContext retrieves turnState from context (exported for tools) // TurnStateFromContext retrieves turnState from context (exported for tools)
func TurnStateFromContext(ctx context.Context) *turnState { func TurnStateFromContext(ctx context.Context) *turnState {
return turnStateFromContext(ctx) return turnStateFromContext(ctx)
} }