Files
unraid-docker-manager/.planning/debug/keyword-router-debug-routing.md
T
2026-02-08 18:56:44 -05:00

4.7 KiB

status, trigger, created, updated
status trigger created updated
diagnosed Investigate why /debug status is treated as container status search instead of being ignored 2026-02-08T00:00:00Z 2026-02-08T00:00:00Z

Current Focus

hypothesis: "contains status" rule at index 1 matches "/debug status" because the check is a simple substring match test: Read Keyword Router rules and verify rule ordering expecting: No startsWith rules for /debug or /errors that would intercept before the contains rules next_action: Document root cause

Symptoms

expected: Removed debug commands (/debug status, /errors) should be ignored or fall through to unrecognized input handler actual: "/debug status" is treated as a container status search for "/debug"; "/errors" shows commands menu (fallback) errors: N/A (functional misbehavior, not an error) reproduction: Send "/debug status" or "/errors" to the Telegram bot started: After debug commands were removed in phase 10.2

Eliminated

(none needed - root cause found on first pass)

Evidence

  • timestamp: 2026-02-08T00:00:00Z checked: Keyword Router rules (lines 156-371 of n8n-workflow.json) found: | 9 rules in this order (0-indexed): 0: /start -> startsWith "/start" -> output "menu" -> Show Menu 1: status -> contains "status" -> output "status" -> Prepare Status Input 2: restart -> contains "restart" -> output "restart" -> Detect Batch Command 3: start -> contains "start" -> output "start" -> Detect Batch Command 4: stop -> contains "stop" -> output "stop" -> Detect Batch Command 5: update all -> regex "update.?all|updateall" -> output "updateall" -> Get All Containers For Update All 6: update -> contains "update" -> output "update" -> Detect Batch Command 7: logs -> contains "logs" -> output "logs" -> Parse Logs Command 8: list -> contains "list" -> output "status" -> Prepare Status Input Fallback: "extra" (index 9) -> Show Menu implication: | No rules exist for /debug or /errors. These are NOT intercepted by any startsWith rule. The n8n Switch node evaluates rules top-to-bottom and routes to the FIRST match.

  • timestamp: 2026-02-08T00:00:00Z checked: How "/debug status" is routed found: | Rule 0 (/start startsWith): "/debug status" does NOT start with "/start" -> skip Rule 1 (status contains): "/debug status" DOES contain "status" -> MATCH Routes to output index 1 -> Prepare Status Input The text "/debug status" is sent to the status sub-workflow which interprets "/debug" as a container search query. implication: This is the confirmed root cause for "/debug status" misbehavior.

  • timestamp: 2026-02-08T00:00:00Z checked: How "/errors" is routed found: | Rule 0-8: "/errors" does NOT match any of: startsWith /start, contains status, contains restart, contains start, contains stop, regex update.?all, contains update, contains logs, contains list -> Falls through all rules to fallback Fallback output (index 9) -> Show Menu implication: "/errors" hits the fallback which shows the commands menu. This is the "extra" output.

  • timestamp: 2026-02-08T00:00:00Z checked: Connection map for Keyword Router (lines 5243-5315) found: | Output index mapping: 0 (menu /start) -> Show Menu 1 (status) -> Prepare Status Input 2 (restart) -> Detect Batch Command 3 (start) -> Detect Batch Command 4 (stop) -> Detect Batch Command 5 (updateall) -> Get All Containers For Update All 6 (update) -> Detect Batch Command 7 (logs) -> Parse Logs Command 8 (list) -> Prepare Status Input 9 (fallback/extra) -> Show Menu implication: Fallback goes to Show Menu, which is why /errors shows the commands menu.

Resolution

root_cause: | The Keyword Router has no rules to intercept /debug or /errors commands (which were removed in phase 10.2).

  1. "/debug status" matches rule index 1 ("contains status") because the substring "status" appears in the input. This routes to Prepare Status Input, which treats "/debug" as a container name query — resulting in a container status search for a non-existent container called "/debug".

  2. "/errors" matches NO rules and falls through to the fallback output ("extra"), which is connected to Show Menu — resulting in the commands menu being displayed.

The fundamental issue: there are no startsWith rules for "/debug" or "/errors" that would catch these inputs BEFORE the generic "contains" rules match substrings within them. Per CLAUDE.md conventions: "startsWith rules (e.g., /debug, /errors) must come BEFORE generic contains rules, otherwise /debug status matches contains 'status' first."

fix: (read-only investigation - not applied) verification: (read-only investigation - not applied) files_changed: []