Commit 757c844
fix(orchestration): WorkflowDocumenter migrate chat_completion → chat (#7042)
Closes the runtime AttributeError discovered behind PR #7036 (#6983).
After the #3185 LLMInterface retirement, ``WorkflowDocumenter`` retained
its docstring-typed ``llm_interface`` slot and called
``self.llm_interface.chat_completion(...)`` — a method that doesn't
exist on LLMService. Boot succeeded (the slot is ``Optional[Any]``), but
the summary path raised AttributeError silently behind the broad
``except Exception`` guard at the call site, so workflow documentation
always shipped without the ``generated_summary`` field.
Migration applied
-----------------
- Constructor param ``llm_interface`` → ``llm_service`` (also closes
#7092 item 2). Single external caller is ``orchestrator.py:535``,
updated in the same commit.
- Stored attribute ``self.llm_interface`` → ``self.llm_service``.
- Method call ``self.llm_interface.chat_completion(...)`` →
``self.llm_service.chat(messages=...)`` per the LLMService contract.
- Response read pattern ``summary_result.get("content", "")`` →
``response.content`` gated by ``not response.error`` (LLMResponse
is a Pydantic model with attribute access; the dict-style access
would have been the same class of bug as #6940).
- Dropped the ``model="default"`` placeholder kwarg — LLMService picks
its own default when ``model_name`` is omitted; the old
LLMInterface.chat_completion accepted "default" as a sentinel that
no longer exists.
- Cleaned up the transient ``# #6983: ...`` comment block at
orchestrator.py:531-534 (the "tracked separately" follow-up landed
in this commit; the comment is no longer accurate). Per CLAUDE.md
style: rationale-only WHY comments, no issue-number prefix.
Verification
------------
Added ``orchestration/workflow_documentation_summary_test.py`` —
7 tests pinning the contract:
- Constructor param renamed → only ``llm_service`` works
- Stored attribute renamed → ``self.llm_service`` only
- **Method-call regression pin**: stub ``llm_service.chat_completion``
set to ``AssertionError`` side-effect; test fails if a future
change reintroduces the legacy call
- No-LLM path early-returns without writing a summary field
- LLMResponse.error truthy → no partial summary written
- chat() raises → broad except still swallows + logs warning
- **Source-level pin**: assert ``.chat_completion(`` is absent
from the migrated method's source
$ python3 -m pytest \
autobot-backend/orchestration/workflow_documentation_summary_test.py -xvs
============================== 7 passed in 0.75s ===============================
Verified post-fix:
$ PYTHONPATH=autobot-backend:. python3 -c "import orchestrator"
orchestrator OK
$ grep -n "llm_interface" workflow_documentation.py orchestrator.py
(empty — all renamed)
Per the [verify-return-shape-in-method-migration](https://github.com/mrveiss/AutoBot-AI/blob/Dev_new_gui/.claude/projects/feedback_verify_return_shape_in_method_migration.md) memory:
- LLMService.chat() returns LLMResponse (verified via inspect.signature)
- LLMResponse.content: str / .error: Optional[str] (verified earlier)
- chat() accepts messages= kwarg (verified)
Closes #7042
Closes #7092 item 2 (WorkflowDocumenter param rename)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 2b3291b commit 757c844
3 files changed
Lines changed: 177 additions & 15 deletions
File tree
- autobot-backend
- orchestration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
176 | | - | |
| 175 | + | |
177 | 176 | | |
178 | 177 | | |
179 | 178 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 179 | + | |
| 180 | + | |
184 | 181 | | |
185 | 182 | | |
186 | 183 | | |
| |||
Lines changed: 169 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | 531 | | |
536 | 532 | | |
537 | | - | |
| 533 | + | |
538 | 534 | | |
539 | 535 | | |
540 | 536 | | |
| |||
0 commit comments