코드탭 pre-LLM 단계 결정을 별도 서비스로 분리

- AgentLoopPreLlmStageService를 추가해 thinking summary, Gemini free-tier delay, user prompt submit hook, missing-tool guard, request assembly handoff를 한 단계로 정리함

- AgentLoopService는 pre-LLM stage 결과를 소비하는 형태로 단순화해 history/query assembly 다음 단계가 claw-code처럼 더 선명하게 보이도록 구조를 개선함

- AgentLoopPreLlmStageServiceTests를 추가하고 관련 구조 테스트 60개를 통과시켰으며 dotnet build 경고/오류 0으로 검증함
This commit is contained in:
2026-04-16 02:18:05 +09:00
parent 2e1c7be8c3
commit 1ec529ed1c
6 changed files with 443 additions and 56 deletions

View File

@@ -303,3 +303,21 @@ Updated: 2026-04-16 02:05 (KST)
- Remaining follow-up:
- keep extracting more inline AgentLoop responsibilities into smaller staged services where it improves observability or retry correctness
- continue measuring long Code runs against claw-code-style continuity scenarios
Updated: 2026-04-16 02:13 (KST)
- Delivered in this pass:
- structural alignment step:
- `AgentLoopPreLlmStageService.cs` now owns the iteration decisions immediately before the LLM call.
- the service centralizes:
- thinking-summary selection
- Gemini free-tier delay planning
- user-prompt submit hook fingerprint/payload planning
- missing-tool guard shaping
- request assembly handoff
- `AgentLoopService.cs` now consumes that stage result instead of computing those branches inline.
- test coverage step:
- `AgentLoopPreLlmStageServiceTests.cs` now locks the new pre-LLM decision layer.
- Remaining follow-up:
- continue extracting the actual LLM dispatch / streaming callback branch into a narrower execution service
- compare long-running Code traces against claw-code-style staged transitions and keep reducing inline loop logic

View File

@@ -1850,3 +1850,26 @@ UI ?遺우쁽????域뱀뮆???귐뗫솯?醫딆춦 ???袁る퓮 ?臾믩씜 ??疫
- 검증:
- `dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify_query_assembly_structure\\ -p:IntermediateOutputPath=obj\\verify_query_assembly_structure\\` 경고 0 / 오류 0
- `dotnet test src/AxCopilot.Tests/AxCopilot.Tests.csproj -c Release -v minimal --filter "AgentLoopQueryAssemblyServiceTests|AgentLoopIterationPreparationServiceTests|AgentLoopLlmRequestPreparationServiceTests|AgentMessageInvariantHelperTests|SessionLearningCollectorTests|CodeTaskWorkingSetServiceTests|AgentLoopE2ETests" -p:OutputPath=bin\\verify_query_assembly_structure_tests\\ -p:IntermediateOutputPath=obj\\verify_query_assembly_structure_tests\\` 통과 56
업데이트: 2026-04-16 02:13 (KST)
- Code 탭 pre-LLM stage 구조를 단계형 서비스로 추가 분리했습니다.
- `src/AxCopilot/Services/Agent/AgentLoopPreLlmStageService.cs`
- 반복당 LLM 호출 직전 결정을 한 곳으로 모았습니다.
- thinking summary 선택
- Gemini free-tier delay 계획
- user prompt submit hook fingerprint/payload 생성
- missing-tool guard 문구 생성
- final request assembly handoff
를 담당합니다.
- `src/AxCopilot/Services/Agent/AgentLoopService.cs`
- 위 결정들을 직접 계산하던 인라인 코드를 제거하고, pre-LLM stage 결과를 해석해 이벤트/대기/훅 실행만 수행하도록 단순화했습니다.
- 결과적으로 AgentLoop는 `history/query assembly -> pre-LLM stage -> dispatch -> tool execution/recovery` 흐름으로 읽히게 됐습니다.
- `src/AxCopilot.Tests/Services/AgentLoopPreLlmStageServiceTests.cs`
- free-tier delay 계획
- prompt hook fingerprint dedup
- runtime policy missing-tool failure
- working set supplemental request assembly
를 회귀 테스트로 고정했습니다.
- 검증:
- `dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify_pre_llm_stage_structure\\ -p:IntermediateOutputPath=obj\\verify_pre_llm_stage_structure\\` 경고 0 / 오류 0
- `dotnet test src/AxCopilot.Tests/AxCopilot.Tests.csproj -c Release -v minimal --filter "AgentLoopPreLlmStageServiceTests|AgentLoopQueryAssemblyServiceTests|AgentLoopIterationPreparationServiceTests|AgentLoopLlmRequestPreparationServiceTests|AgentMessageInvariantHelperTests|SessionLearningCollectorTests|CodeTaskWorkingSetServiceTests|AgentLoopE2ETests" -p:OutputPath=bin\\verify_pre_llm_stage_structure_tests\\ -p:IntermediateOutputPath=obj\\verify_pre_llm_stage_structure_tests\\` 통과 60