Skip to content

fix(fsapp): avoid premature task finalization#686

Open
Tomodad wants to merge 1 commit into
lsdefine:mainfrom
Tomodad:fix/fsapp-turn-hook-false-terminal
Open

fix(fsapp): avoid premature task finalization#686
Tomodad wants to merge 1 commit into
lsdefine:mainfrom
Tomodad:fix/fsapp-turn-hook-false-terminal

Conversation

@Tomodad

@Tomodad Tomodad commented Jul 14, 2026

Copy link
Copy Markdown

Summary

  • keep the Feishu turn hook summary-only
  • prevent turn-level exit_reason metadata from finalizing queued work early
  • preserve display_queue's done item as the normal task-finalization path

Fixes #685.

Root cause

_make_task_hook received _finish as on_final and invoked it whenever a hook context contained exit_reason. That metadata can describe an intermediate agent turn rather than completion of the queued Feishu task, so _finish could set result["sent"] before the display queue published its real done item.

Change

Remove the final callback from _make_task_hook and let the hook handle only summary -> card.step. The existing display-queue done -> _finish path and timeout/stop/error failure paths are unchanged.

Verification

  • isolated AST harness: 14/14 passed
  • parent revision reproduces premature finalization
  • candidate blocks exit_reason finalization while preserving summary updates
  • adversarial cases cover missing response, empty summary, combined summary + exit_reason, repeated calls, inactive task IDs, and formatting inputs
  • python -m py_compile frontends/fsapp.py
  • git diff --check
  • one file changed: 4 insertions, 8 deletions
  • no dependencies added

Keep task hooks summary-only so turn-end metadata cannot finalize queued work before display queue done.

Co-Authored-By: GenericAgent <bot@gaagent.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fsapp] turn-end exit_reason can finalize a queued task before display queue done

1 participant