Questions: agents write their findings before asking; an open question isn't 'Stopped'
An agent put its whole analysis in thinking (not shown) and asked a question straight away, so the operator saw only the question form under a 'Stopped after 2 tools' row. The Pipelines tool instructions now tell agents to write what they found before asking, and an activity row with an open question reads '... · waiting for your answer'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -103,18 +103,38 @@ class ChatTurnActivityData {
|
||||
final noun = commands
|
||||
? (calls.length == 1 ? 'command' : 'commands')
|
||||
: (calls.length == 1 ? 'tool' : 'tools');
|
||||
// A question still open is the agent waiting on the operator, not a
|
||||
// stopped turn: say so instead of "Stopped after".
|
||||
final asking = calls.any(
|
||||
(p) => chatToolIsQuestion(p) && !chatToolSettled(p),
|
||||
);
|
||||
final summary =
|
||||
'${unfinished
|
||||
'${unfinished && !asking
|
||||
? 'Stopped after'
|
||||
: commands
|
||||
? 'Ran'
|
||||
: 'Used'} ${calls.length} $noun';
|
||||
return failed == 0 ? summary : '$summary · $failed failed';
|
||||
final status = asking ? '$summary · waiting for your answer' : summary;
|
||||
return failed == 0 ? status : '$status · $failed failed';
|
||||
}
|
||||
|
||||
bool get failed => tools.any(chatToolFailed);
|
||||
}
|
||||
|
||||
/// Whether [tool] asks the operator a question (Claude Code's
|
||||
/// AskUserQuestion, or a harness tool named like it).
|
||||
bool chatToolIsQuestion(JsonMap tool) {
|
||||
final name = chatToolLabel(tool).toLowerCase().replaceAll('_', '');
|
||||
return name == 'askuserquestion' || name == 'question';
|
||||
}
|
||||
|
||||
/// Whether [tool] has a final state (completed, failed or answered).
|
||||
bool chatToolSettled(JsonMap tool) {
|
||||
final state = tool['state'];
|
||||
final status = state is Map ? '${state['status']}' : '$state';
|
||||
return const ['completed', 'error', 'failed', 'done'].contains(status);
|
||||
}
|
||||
|
||||
/// Whether [tool] is a shell command (`Ran N commands`), not another tool.
|
||||
bool chatToolIsCommand(JsonMap tool) => const [
|
||||
'bash',
|
||||
|
||||
Reference in New Issue
Block a user