Skip to content

Commit 7acfda4

Browse files
loningclaude
andcommitted
fix-codex round-3: address PR #687 v4 reviewer demands (cluster-024) — last round
Applied 4 fixes (FIX_DONE:687:round-3:applied-4:rejected-0:blocked-0): - (A) architect: add missing Refactor (iter15/cluster-024) anchor on AIGAgentBase.cs:202 documenting the deleted protected ChatAsync helper surface (subclasses now use ChatStreamAsync + local aggregation only when needed) - (A) architect: remove inaccurate Refactor comment from ScriptGenerateGAgent.GenerateWithReasoningAsync — that method was already streaming on origin/dev. Only GenerateAsync keeps the direct-ChatAsync refactor comment - (A) architect: same removal on WorkflowGenerateGAgent.GenerateWithReasoningAsync - (A) tests: widen ChatRuntimeStreamingBufferTests source-regression scan from src/Aevatar.AI.Core only to: src/Aevatar.AI.Core + src/Aevatar.Studio.Hosting + agents/Aevatar.GAgents.ChatbotClassifier, ignoring provider-boundary abstractions and comment-only lines Build pass; Aevatar.AI.Tests 558 pass; Aevatar.Studio.Tests 521 pass; test_stability_guards pass; git diff --check pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 911d38b commit 7acfda4

4 files changed

Lines changed: 12 additions & 9 deletions

File tree

src/Aevatar.AI.Core/AIGAgentBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ protected sealed override AIAgentConfig MergeEffectiveConfig(AIAgentConfig class
199199
return merged;
200200
}
201201

202+
// Refactor (iter15/cluster-024):
203+
// Old pattern: protected ChatAsync helpers let GAgents call the non-streaming executor as a formal conversation path.
204+
// New principle: GAgent subclasses use ChatStreamAsync; explicit offline aggregation is local to the caller that needs text.
202205
/// <summary>流式 Chat。</summary>
203206
protected IAsyncEnumerable<LLMStreamChunk> ChatStreamAsync(string userMessage, CancellationToken ct = default)
204207
{

src/Aevatar.Studio.Hosting/Endpoints/ScriptGenerateGAgent.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ protected override AIAgentConfigStateOverrides ExtractStateConfigOverrides(Empty
5454
Func<string, CancellationToken, Task>? onReasoning,
5555
CancellationToken ct = default)
5656
{
57-
// Refactor (iter15/cluster-024):
58-
// Old pattern: non-streaming ChatAsync directly called provider.ChatAsync.
59-
// New principle: ChatStreamAsync is the only authoritative AI executor; offline text aggregation consumes the stream as an explicit adapter.
6057
var content = new StringBuilder();
6158
await foreach (var chunk in ChatStreamAsync(prompt, requestId, metadata, ct))
6259
{

src/Aevatar.Studio.Hosting/Endpoints/WorkflowGenerateGAgent.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ protected override AIAgentConfigStateOverrides ExtractStateConfigOverrides(Empty
5454
Func<string, CancellationToken, Task>? onReasoning,
5555
CancellationToken ct = default)
5656
{
57-
// Refactor (iter15/cluster-024):
58-
// Old pattern: non-streaming ChatAsync directly called provider.ChatAsync.
59-
// New principle: ChatStreamAsync is the only authoritative AI executor; offline text aggregation consumes the stream as an explicit adapter.
6057
var content = new StringBuilder();
6158
await foreach (var chunk in ChatStreamAsync(prompt, requestId, metadata, ct))
6259
{

test/Aevatar.AI.Tests/ChatRuntimeStreamingBufferTests.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,17 @@ public async Task ChatAsync_WhenProviderStreamsContent_ShouldAggregateWithoutCal
387387
}
388388

389389
[Fact]
390-
public void AiCoreSource_ShouldNotDirectlyCallProviderChatAsyncOutsideProviderBoundary()
390+
public void UserFacingAiExecutorSurfaces_ShouldNotDirectlyCallProviderChatAsyncOutsideProviderBoundary()
391391
{
392392
var root = FindRepositoryRoot();
393-
var aiCore = Path.Combine(root, "src", "Aevatar.AI.Core");
394-
var offenders = Directory.EnumerateFiles(aiCore, "*.cs", SearchOption.AllDirectories)
393+
var scannedRoots = new[]
394+
{
395+
Path.Combine(root, "src", "Aevatar.AI.Core"),
396+
Path.Combine(root, "src", "Aevatar.Studio.Hosting"),
397+
Path.Combine(root, "agents", "Aevatar.GAgents.ChatbotClassifier"),
398+
};
399+
var offenders = scannedRoots
400+
.SelectMany(scanRoot => Directory.EnumerateFiles(scanRoot, "*.cs", SearchOption.AllDirectories))
395401
.SelectMany(file => File.ReadLines(file)
396402
.Select((line, index) => new { file, line, index })
397403
.Where(x => !x.line.TrimStart().StartsWith("//", StringComparison.Ordinal))

0 commit comments

Comments
 (0)