fix(prompts): apply system default on every run; dedupe roadblocks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-06-04 14:25:55 +02:00
parent 202e8dea49
commit 9a117a5429
3 changed files with 13 additions and 2 deletions

View File

@@ -86,7 +86,7 @@ public sealed class StreamAnalyzer
TokensIn = _tokensIn,
TokensOut = _tokensOut,
ApiRetryCount = _apiRetryCount,
Blocks = _blocks,
Blocks = _blocks.Distinct().ToList(),
};
private string? FallbackResult()

View File

@@ -380,7 +380,7 @@ public sealed class TaskRunner
global = await settingsRepo.GetAsync(ct);
}
var systemFile = PromptFiles.ReadOrNull(PromptKind.System);
var systemFile = PromptFiles.ReadOrDefault(PromptKind.System);
var instructions = MergeInstructions(
systemFile, global.DefaultClaudeInstructions, listConfig?.SystemPrompt, task.SystemPrompt);

View File

@@ -152,4 +152,15 @@ public sealed class StreamAnalyzerTests
analyzer.ProcessLine("""{"type":"result","result":"done","session_id":"s1"}""");
Assert.Empty(analyzer.GetResult().Blocks);
}
[Fact]
public void Duplicate_Marker_In_Assistant_And_Result_Is_Collected_Once()
{
var analyzer = new StreamAnalyzer();
analyzer.ProcessLine("""{"type":"assistant","message":{"content":[{"type":"text","text":"CLAUDEDO_BLOCKED: no creds"}]}}""");
analyzer.ProcessLine("""{"type":"result","result":"summary\nCLAUDEDO_BLOCKED: no creds","session_id":"s1"}""");
var result = analyzer.GetResult();
Assert.Single(result.Blocks);
Assert.Equal("no creds", result.Blocks[0]);
}
}