Commit 100a966
committed
1.3: severity-tracked validation hints
Phase 1.3 — when a turn includes high-severity mutations
(td_create_node, td_delete_node, td_exec_python, etc.) without a
follow-up validator (td_get_errors / td_audit_project /
td_validate_recipe / patch_validate), the runtime emits ``EV_HINT``
so the chat UI can render a soft nudge below the assistant's reply.
Soft signal — never blocks the conversation, never fires on read-only
or medium-only turns.
Reviewer asked for a forced validation continuation; that was too
heavyweight (interrupts every minor mutation, breaks the agent's
flow on legitimate "I'll validate after the next step" plans). A
severity-aware hint is the right balance — informational, dismissable,
visible enough to catch dropped validations.
td_component/tdpilot_api_runtime.py:
- New constants: EV_HINT, _TOOL_SEVERITY (12 high + 3 medium tools
classified), _VALIDATOR_TOOLS (4 entries that satisfy a high
mutation), _tool_severity(name) helper.
- AgentRuntime gains _turn_tool_calls list (cleared at start_turn,
written via on_tool_result callback). _maybe_emit_validation_hint
runs at on_turn_done — checks for high-severity tools without a
validator, emits one EV_HINT event listing the unique offenders.
- Failed tool calls (is_error=True) don't count toward the high
tally — the model already saw the error and didn't actually
mutate state.
td_component/tdpilot_api_extension.py:
- _handle_event grew an EV_HINT branch that writes a "hint"-role
line into both the textTable transcript and the HTML chat.
td_component/tdpilot_api_chat.html:
- .msg.hint CSS class — yellow-ish, dim, italic. Distinct from
.msg.error (red, urgent) since the turn was technically
successful.
- appendMessage's role-to-class mapping covers "hint".
Tests (tests/test_tdpilot_api_runtime.py): 8 new cases.
- test_severity_lookup_classifies_known_tools_correctly
- test_validation_hint_fires_on_high_severity_without_validator
- test_validation_hint_suppressed_when_validator_called
- test_validation_hint_suppressed_for_low_severity_only_turns
- test_validation_hint_suppressed_for_medium_severity_only
- test_validation_hint_ignores_failed_tool_calls
- test_validation_hint_lists_all_high_severity_tools (dedup +
sort verified)
- test_validation_hint_cleared_between_turns (per-turn ledger
reset behaviour)
Pytest 1000 passing (up from 992). Lints + format clean. Three
td_component sources changed — standalone tdpilot_API.tox needs
rebuilding before the chat UI picks up the hint rendering.1 parent 4213d6c commit 100a966
4 files changed
Lines changed: 326 additions & 3 deletions
File tree
- td_component
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
171 | 181 | | |
172 | 182 | | |
173 | 183 | | |
| |||
401 | 411 | | |
402 | 412 | | |
403 | 413 | | |
404 | | - | |
| 414 | + | |
| 415 | + | |
405 | 416 | | |
406 | 417 | | |
407 | 418 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
| 371 | + | |
371 | 372 | | |
372 | 373 | | |
373 | 374 | | |
| |||
403 | 404 | | |
404 | 405 | | |
405 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
406 | 418 | | |
407 | 419 | | |
408 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
154 | 159 | | |
155 | 160 | | |
156 | 161 | | |
| |||
161 | 166 | | |
162 | 167 | | |
163 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
164 | 225 | | |
165 | 226 | | |
166 | 227 | | |
| |||
439 | 500 | | |
440 | 501 | | |
441 | 502 | | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
442 | 511 | | |
443 | 512 | | |
444 | 513 | | |
| |||
478 | 547 | | |
479 | 548 | | |
480 | 549 | | |
481 | | - | |
482 | | - | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
483 | 553 | | |
484 | 554 | | |
| 555 | + | |
485 | 556 | | |
486 | 557 | | |
487 | 558 | | |
| |||
508 | 579 | | |
509 | 580 | | |
510 | 581 | | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
511 | 622 | | |
512 | 623 | | |
513 | 624 | | |
| |||
544 | 655 | | |
545 | 656 | | |
546 | 657 | | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
547 | 661 | | |
548 | 662 | | |
549 | 663 | | |
| |||
0 commit comments