Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

fix(mobile): the log keeps the length of a harness's first task and a search, never the words

deeb13406973c3e
diff --git a/mobile/lib/logging/redact.dart b/mobile/lib/logging/redact.dart
index 458a499b8..aec903b22 100644
--- a/mobile/lib/logging/redact.dart
+++ b/mobile/lib/logging/redact.dart
@@ -20,6 +20,12 @@ final RegExp _secretKey = RegExp(
caseSensitive: false,
);
+/// Key names whose value is what the person wrote: a harness's first task
+/// (`agent_create`'s `prompt`), a search typed or spoken into Find
+/// (`session_search`'s `query`). Not a credential, but not a diagnostic either —
+/// the log keeps its length, which is all a reader needs, and never the words.
+final RegExp _wordsKey = RegExp(r'^(prompt|query)$', caseSensitive: false);
+
/// Values longer than this are clipped — a log line is read by a person, and a
/// base64 blob buries the fields either side of it.
const int _maxValue = 120;
@@ -46,9 +52,12 @@ String redactValue(Object? value) {
final parts = <String>[];
for (final entry in value.entries) {
final key = '${entry.key}';
+ final words = entry.value;
parts.add(
_secretKey.hasMatch(key)
? '$key: <redacted>'
+ : _wordsKey.hasMatch(key) && words is String
+ ? '$key: <${words.length} chars>'
: '$key: ${redactValue(entry.value)}',
);
}
diff --git a/mobile/test/logging/redact_test.dart b/mobile/test/logging/redact_test.dart
index 2699efc78..b942cf5a6 100644
--- a/mobile/test/logging/redact_test.dart
+++ b/mobile/test/logging/redact_test.dart
@@ -27,6 +27,21 @@ void main() {
);
});
+ test('what the person wrote is a length, never the words', () {
+ expect(
+ redactValue({
+ 'engine': 'claude',
+ 'prompt': 'fix the flaky login test',
+ 'cwd': '/work/app',
+ }),
+ '{engine: claude, prompt: <24 chars>, cwd: /work/app}',
+ );
+ expect(
+ redactValue({'query': 'stripe webhook', 'limit': 20}),
+ '{query: <14 chars>, limit: 20}',
+ );
+ });
+
test('a list is a count, never its contents', () {
expect(
redactValue({