Description
The AI Assistant logs a large amount of diagnostic detail unconditionally, including router state and conversation content. This is useful during development but should not run in production builds.
Current behaviour
lib/ai/orchestrator/router_chat_controller.dart:
- Logs the full router context on construction:
_log('Router context:\n$routerContext')
- Logs assistant message previews:
textContent.substring(0, ...clamp(0, 200))
- Logs user message content verbatim
lib/ai/providers/usp_command_provider.dart:
_getConnectedDevices() iterates every device and logs name, IP, connection type and signal strength
- Mesh extender names and MAC addresses are logged
buildRouterContext() logs model name, firmware version, WAN IP and per-band SSIDs
generative_ui's AwsContentGenerator additionally debugPrints the request body preview (up to 500 chars), which includes the system prompt and conversation.
Why this matters
Device names, IP/MAC addresses, SSIDs and conversation content are user data. Logging them unconditionally is a privacy concern in shipped builds.
Proposed approach
- Gate the verbose
[AI] logging behind kDebugMode (or an existing project-level log-level mechanism if one is preferred — worth checking what the logger already supports)
- Keep structural / lifecycle logs (loop iteration, tool name, success/failure, token counts) since they are useful and non-sensitive
- Drop or redact: full router context dump, message content previews, per-device identifiers
- The
debugPrint calls inside generative_ui need a separate change in the UI kit repo — track separately if it turns out to be needed
Acceptance criteria
Context
Follow-up to #929.
Description
The AI Assistant logs a large amount of diagnostic detail unconditionally, including router state and conversation content. This is useful during development but should not run in production builds.
Current behaviour
lib/ai/orchestrator/router_chat_controller.dart:_log('Router context:\n$routerContext')textContent.substring(0, ...clamp(0, 200))lib/ai/providers/usp_command_provider.dart:_getConnectedDevices()iterates every device and logs name, IP, connection type and signal strengthbuildRouterContext()logs model name, firmware version, WAN IP and per-band SSIDsgenerative_ui'sAwsContentGeneratoradditionallydebugPrints the request body preview (up to 500 chars), which includes the system prompt and conversation.Why this matters
Device names, IP/MAC addresses, SSIDs and conversation content are user data. Logging them unconditionally is a privacy concern in shipped builds.
Proposed approach
[AI]logging behindkDebugMode(or an existing project-level log-level mechanism if one is preferred — worth checking what the logger already supports)debugPrintcalls insidegenerative_uineed a separate change in the UI kit repo — track separately if it turns out to be neededAcceptance criteria
flutter analyzecleanContext
Follow-up to #929.