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:
2026-11-26 14:08:38 +00:00
parent 4d86fe5a7f
commit daf290e39e
3 changed files with 60 additions and 3 deletions
@@ -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',
@@ -0,0 +1,35 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/domain/chat_turn_activity.dart';
Map<String, dynamic> _tool(String name, String status) => {
'type': 'tool',
'id': name,
'name': name,
'state': {'status': status, 'title': ''},
};
void main() {
test('an open question reads as waiting for the operator, not stopped', () {
final activity = ChatTurnActivityData([
_tool('Bash', 'completed'),
_tool('AskUserQuestion', 'pending'),
], streaming: false);
expect(activity.label, 'Used 2 tools · waiting for your answer');
});
test('an answered question is an ordinary used tool', () {
final activity = ChatTurnActivityData([
_tool('Bash', 'completed'),
_tool('AskUserQuestion', 'completed'),
], streaming: false);
expect(activity.label, 'Used 2 tools');
});
test('another interrupted tool still reads as stopped', () {
final activity = ChatTurnActivityData([
_tool('Bash', 'completed'),
_tool('Read', 'interrupted'),
], streaming: false);
expect(activity.label, 'Stopped after 2 tools');
});
}
+3 -1
View File
@@ -26,7 +26,9 @@ func IsTool(name string) bool {
const Instructions = "These tools act on Pipelines, the app the operator reads this chat in, not on your workspace. " +
"Use show_file / show_image instead of telling the operator a path to open, show_html for diagrams, charts or small visual views, " +
"show_diff when the operator asks to see changes or a diff (for example before submitting a pull request), " +
"and notify only when the operator should look at their phone now."
"and notify only when the operator should look at their phone now. " +
"Your thinking is not shown to the operator: before asking them a question (for example with AskUserQuestion), " +
"write what you found and why you are asking as a normal message, because the question form shows only the question and its options."
type toolDefinition struct {
Name string `json:"name"`