From 68b5392e15f6da2ac975a0afaf8b71744cbd2b65 Mon Sep 17 00:00:00 2001 From: kami Date: Sun, 26 Jul 2026 22:29:58 +0400 Subject: [PATCH] fix(context): emit the manifest on every context rebuild, not just the first (#307) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit c742656e emitted ContextAssembledEvent only at the stage's initial contextPackBuilder.build. But the question that motivated #307 — "did the ACR steer-away hint fire on 7 consecutive turns?" — is a per-rebuild question: unconfirmedFixEntries recomputes on every rebuild, which is exactly the #306 bug. With one event per stage the log still couldn't answer it. Emit at all four build sites, matching emitContextTruncationIfNeeded's existing placement: pushBack, the tool-round rebuild, and the tools-less clean emission. ./gradlew check green. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01HgDL1v3GuQ9RZnYR6fDT95 --- .../core/kernel/orchestration/SessionOrchestratorExecution.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/kernel/src/main/kotlin/com/correx/core/kernel/orchestration/SessionOrchestratorExecution.kt b/core/kernel/src/main/kotlin/com/correx/core/kernel/orchestration/SessionOrchestratorExecution.kt index 24bf1694..fbc0e013 100644 --- a/core/kernel/src/main/kotlin/com/correx/core/kernel/orchestration/SessionOrchestratorExecution.kt +++ b/core/kernel/src/main/kotlin/com/correx/core/kernel/orchestration/SessionOrchestratorExecution.kt @@ -367,6 +367,7 @@ internal suspend fun SessionOrchestrator.executeStage( budget = TokenBudget(limit = stageConfig.tokenBudget), ) emitContextTruncationIfNeeded(sessionId, stageId, currentContext) + emitContextAssembled(sessionId, stageId, currentContext) toolRounds++ return runInference( sessionId, stageId, currentContext, stageConfig, config.stageTimeoutMs, responseFormat, effectives, @@ -546,6 +547,7 @@ internal suspend fun SessionOrchestrator.executeStage( budget = TokenBudget(limit = stageConfig.tokenBudget), ) emitContextTruncationIfNeeded(sessionId, stageId, currentContext) + emitContextAssembled(sessionId, stageId, currentContext) inferenceResult = runInference( sessionId, stageId, currentContext, stageConfig, config.stageTimeoutMs, responseFormat, effectives, ) @@ -579,6 +581,7 @@ internal suspend fun SessionOrchestrator.executeStage( entries = accumulatedEntries, budget = TokenBudget(limit = stageConfig.tokenBudget), ) + emitContextAssembled(sessionId, stageId, currentContext) inferenceResult = runInference( sessionId, stageId, currentContext, stageConfig, config.stageTimeoutMs, responseFormat, effectives, withTools = false,