Diagnoses and fixes issues in LG Flutter apps — SSH connection failures, KML rendering problems, coordinate bugs, Provider errors, and rig communication issues.
This skill systematically diagnoses and resolves bugs in Liquid Galaxy Flutter controller applications. It covers the full debugging spectrum from SSH connection problems to KML rendering issues on the rig.
Announce at start: "I'm using the lg-debugger skill to diagnose: [Issue Description]."
GUARDRAIL: If the student wants to skip understanding the root cause, trigger the Critical Advisor (.agent/skills/lg-critical-advisor/SKILL.md). Debugging is learning.
Symptoms: App can't connect, timeout errors, "Connection refused."
Diagnostic Steps:
ping <lg-master-ip>.ssh lg@<ip> from terminal.dartssh2 usage: verify SSHSocket connection code.Common Fixes:
// WRONG: Missing timeout
await SSHSocket.connect(host, port);
// RIGHT: Always set a connection timeout
await SSHSocket.connect(host, port, timeout: const Duration(seconds: 10));
Symptoms: KML sent but nothing appears on the rig screens.
Diagnostic Steps:
longitude,latitude — most bugs are swapped lat/lon./var/www/html/kml/slave_0.kml (check slave number).clearKML() before sendKML().echo '...' > /path command executes without error.Common Fixes:
// WRONG: Lat/Lon swapped
'<coordinates>$latitude,$longitude,0</coordinates>'
// RIGHT: KML is lon,lat,alt
'<coordinates>$longitude,$latitude,0</coordinates>'
Symptoms: UI doesn't update, "ProviderNotFoundException", stale data.
Diagnostic Steps:
MultiProvider in main.dart.context.watch<T>() for reactive rebuilds, context.read<T>() for one-time.dispose() called?Symptoms: App freezes, unhandled exceptions, loading states stuck.
Diagnostic Steps:
_isLoading set to false in finally block?Symptoms: flutter analyze fails, red underlines, missing imports.
Diagnostic Steps:
flutter pub get — dependency resolution.flutter clean && flutter pub get — clear build cache.pubspec.yaml — correct package names and versions.lib/.? and ! operators used correctly.1. Reproduce → Can you trigger the bug consistently?
2. Isolate → Which layer? (UI, Service, SSH, KML, API)
3. Trace → Follow data flow: Widget → Service → SSH → Rig
4. Fix → Apply targeted fix in the correct layer
5. Verify → flutter analyze + flutter test + manual test
6. Document → Add to docs/tech-debt.md if it was a systemic issue
# Check if LG rig is reachable
ping 192.168.1.100
# SSH into LG master manually
ssh [email protected]
# Check if Google Earth is running on the rig
ssh [email protected] "pgrep -f google-earth"
# Read current KML on master
ssh [email protected] "cat /var/www/html/kml/slave_0.kml"
# Read current query (camera control)
ssh [email protected] "cat /tmp/query.txt"
# Clear all KML manually
ssh [email protected] "echo '' > /var/www/html/kml/slave_0.kml"
# Relaunch Google Earth
ssh [email protected] "killall googleearth-bin; sleep 2; /opt/google/earth/pro/googleearth-bin &"
⛔ STOP and WAIT — After identifying the bug, ask:
"I've found the root cause: [describe the issue]. Before I apply the fix — can you explain in your own words WHY this bug happens? What's the underlying principle being violated?"
Wait for the student's answer. Evaluate:
notifyListeners(), no timeout).⛔ STOP and WAIT — Ask:
"I'm about to change [file/method]. What do you think the fix looks like? Describe the change before I show you the code."
Let the student attempt to describe the fix, then show the actual code.
⛔ STOP and WAIT — After applying and verifying the fix, ask:
"How would you prevent this type of bug in the future? Should we add a test for this case?"
For systemic issues, save to docs/tech-debt.md (already existing).
Additionally, save debug session context:
Save to: docs/aimentor/YYYY-MM-DD-debug-session.md
Include:
After fix → lg-code-reviewer for verification that the fix is clean.
After the fix is applied, verified, and the student understands the root cause, automatically offer the next stage:
"Bug squashed and verified! You traced the root cause like a pro. Want to resume the pipeline where we left off, or run a code review on the fix? 🐛→✅"
If student wants to resume → activate .agent/skills/lg-resume-pipeline/SKILL.md.
If student wants review → activate .agent/skills/lg-code-reviewer/SKILL.md.