Files
kandev/apps
João Salavisa 6ee7369efc fix(backend): keep cancelled office turns promptable instead of parking IDLE (#1088)
* fix(backend): keep cancelled office turns promptable instead of parking IDLE

A user-initiated turn cancel on an office task was racing the
agent.complete stream handler. The complete handler unconditionally
flipped the session to IDLE (the "parked between scheduler runs"
state), overwriting Service.CancelAgent's WAITING_FOR_INPUT write
that arrived a moment earlier. The next prompt was then rejected by
checkSessionPromptable with "session is in IDLE state".

Skip the office IDLE branch when the complete event carries
stop_reason="cancelled". The cancel handler already drives state
reconciliation for user cancels; falling through to the kanban
WAITING_FOR_INPUT path leaves the session promptable.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* refactor(backend): shorten extractStopReason and stopReasonCancelled comments

Trim multi-line docstrings that violated CLAUDE.md's one-short-line rule
down to one or two lines, keeping only the non-obvious cross-file sync note.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(backend): compress remaining multi-line comment blocks to one line

Second pass of comment trimming per CLAUDE.md convention — the
handleCompleteStreamEvent stop_reason context block and the
handleOfficeTurnComplete stopReason paragraph were still too long.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(backend): collapse remaining multi-line comments to one-liners

Address Claude bot review threads on PR #1088: the production helper
docs (extractStopReason, stopReasonCancelled, handleOfficeTurnComplete)
and the new test functions still carried multi-line comment blocks,
which violate CLAUDE.md's "one short line max" rule.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Kandev Agent <agent@kandev.dev>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 16:33:12 +01:00
..
2026-05-25 21:27:20 +00:00