Repository navigation
Commit cf1a572
committed
fix(kiro): explain empty exec output and stop reopening a delivered final answer
Two defects made a Kiro code-mode session unable to see its own tool output and
unable to end its turn.
**Empty exec output was unexplained.** A code-mode `exec` cell that never calls
`text()`/`notify()` returns nothing — the last expression value is not echoed.
Kiro received the generic "The tool completed without textual output.", so the
model concluded its earlier context was lost and restarted finished work. Cursor
already had the actionable wording for exactly this state; Kiro had no
equivalent. The detection now lives in `src/adapters/exec-tool-result-normalize.ts`
and both adapters share one message, so the wording cannot drift. Cursor keeps
`normalizeCursorToolResultText` as a wrapper: it owns Computer Use precedence
and isError policy, which are not Kiro's.
Checked before `text.trim()` deliberately — the wrapper form
("Script completed\nWall time ...\nOutput:\n") is non-blank and would otherwise
pass through as though it were real output. Non-exec tools keep the generic
message; asserting code-mode semantics for arbitrary tools would tell a model to
call `text()` in a runtime that has neither.
**A delivered final answer was told to continue.** The trailing-turn predicate was
`turns.at(-1)?.kind === "assistant"`, which cannot tell "stopped mid-task" from
"already answered". Both got a continuation or completion-retry prompt, so a
closed task read as a still-open goal and looped. The turn now carries whether it
was the delivered final answer, keyed off Responses `phase: "final_answer"`
(preserved through the parser) rather than guessed from position.
Kiro still requires a trailing user turn, so the turn is still appended — only its
text changes, to a neutral acknowledgement that withholds any instruction to
resume. Removing the append instead would throw at the `currentTurn` pop. The
`text_fallback` and thinking-tag paths are both excluded, since either would
re-append the resume instruction and reinstate the loop.
A merged assistant turn counts as final only when its last component was, so
commentary after an answer correctly reopens continuation.
Verification: `bun x tsc --noEmit` clean; 201 tests pass across
kiro-adapter, kiro-stream, cursor-exec-empty-result, cursor-toolresult-normalize
and server-kiro-completion-e2e; privacy:scan and the core/lab boundary and
repo-hygiene guards green. Both new assertions were driven red by reverting each
fix individually, so neither is vacuous.1 parent 80e251a commit cf1a572
5 files changed
Lines changed: 238 additions & 39 deletions
File tree
- src/adapters
- cursor
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
12 | 18 | | |
13 | 19 | | |
14 | 20 | | |
| |||
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
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 | 38 | | |
58 | 39 | | |
59 | 40 | | |
| |||
74 | 55 | | |
75 | 56 | | |
76 | 57 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 58 | | |
81 | 59 | | |
82 | 60 | | |
| |||
107 | 85 | | |
108 | 86 | | |
109 | 87 | | |
110 | | - | |
| 88 | + | |
111 | 89 | | |
112 | 90 | | |
113 | 91 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
25 | 37 | | |
26 | 38 | | |
27 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
344 | 346 | | |
345 | 347 | | |
346 | 348 | | |
347 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
348 | 362 | | |
349 | 363 | | |
350 | 364 | | |
| |||
521 | 535 | | |
522 | 536 | | |
523 | 537 | | |
524 | | - | |
| 538 | + | |
525 | 539 | | |
526 | 540 | | |
527 | 541 | | |
528 | 542 | | |
529 | 543 | | |
530 | 544 | | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
531 | 548 | | |
532 | | - | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
533 | 556 | | |
534 | 557 | | |
535 | 558 | | |
| |||
559 | 582 | | |
560 | 583 | | |
561 | 584 | | |
562 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
563 | 588 | | |
564 | 589 | | |
565 | 590 | | |
566 | 591 | | |
567 | 592 | | |
568 | 593 | | |
569 | | - | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
570 | 603 | | |
571 | 604 | | |
572 | 605 | | |
| |||
587 | 620 | | |
588 | 621 | | |
589 | 622 | | |
590 | | - | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
591 | 634 | | |
592 | 635 | | |
593 | | - | |
| 636 | + | |
594 | 637 | | |
595 | 638 | | |
596 | 639 | | |
| |||
638 | 681 | | |
639 | 682 | | |
640 | 683 | | |
641 | | - | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
642 | 688 | | |
643 | 689 | | |
644 | | - | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
645 | 695 | | |
646 | 696 | | |
647 | 697 | | |
| |||
0 commit comments