[03-Developer] #260 round 2: AC-9 + AC-10 보강
QA round 1 환송 노트 (#260 카테고리 63 환송) 의 두 결함 수정. AC-9 — tool result 2KB 가드 runtime 연결 - chat_providers.dart userTurn: result.toJson() → encodeToolResult 통과 후 jsonDecode 한 Map 을 LlmChatSession.sendToolResult 로 전달. - encodeToolResult 가 더 이상 dead code 가 아니다. ADR-0005 / OQ-2 의 2KB hard cap 이 실 경로에서 적용됨. - 회귀: chat_session_controller_test.dart 신규 'AC-9 대용량 → cap' 케이스 — 인위 huge_dump tool 로 _truncated:true + _hint 검증. AC-10 — widget E2E 신규 - app/test/ui/chat_screen_test.dart 신규 (2 testWidgets): 1) add_habit tool call → ConfirmDialog '수행' → habits +1 + 모델 마무리. 2) ConfirmDialog '취소' → habits 무변화 + 'tool 취소됨' 라벨. - ProviderScope overrides: appDatabaseProvider / llmServiceProvider / bootstrapProvider / toolDepsProvider. 회귀 - 신규 3 (cap 1 + widget 2) → 151 → 154 passed (1 skip) - flutter analyze: clean Refs #260
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -183,7 +185,12 @@ class ChatSessionController extends StateNotifier<ChatSessionState> {
|
||||
);
|
||||
|
||||
pendingToolName = toolCall.name;
|
||||
pendingToolResult = result.toJson();
|
||||
// ADR-0005 / OQ-2: hard-cap tool result at 2KB so LLM context window
|
||||
// can't be blown by a runaway ToolOk payload. encodeToolResult applies
|
||||
// truncate-with-hint when needed; jsonDecode round-trips back to a Map
|
||||
// because the chat session API expects Map<String, dynamic>.
|
||||
final capped = jsonDecode(encodeToolResult(result)) as Map<String, dynamic>;
|
||||
pendingToolResult = capped;
|
||||
final capturedName = pendingToolName;
|
||||
final capturedResult = pendingToolResult;
|
||||
nextStream = () => _session!.sendToolResult(
|
||||
|
||||
Reference in New Issue
Block a user