From 8491527b3c64dd1a608154d900406ff7aa277dff Mon Sep 17 00:00:00 2001 From: Wu Shuwen Date: Tue, 27 Oct 2026 12:40:48 +0800 Subject: [PATCH] fix(s11): document unreachable else branch in inject_background_results (#584) The else branch in inject_background_results is never reached in the current agent_loop call pattern, where messages[-1] is always a user message. Kept for independent reuse or future wake-up scenarios. --- s11_background_tasks/code.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/s11_background_tasks/code.py b/s11_background_tasks/code.py index 8492e85d..5ac1262a 100644 --- a/s11_background_tasks/code.py +++ b/s11_background_tasks/code.py @@ -460,6 +460,9 @@ def inject_background_results(messages: list) -> int: *blocks, ] else: + # Currently unreachable: agent_loop always leaves messages[-1] as a + # user message, so this branch is never hit in the teaching code. + # Kept for independent reuse or future wake-up from background tasks. messages.append({"role": "user", "content": blocks}) return len(notifications)