Skip to content

WordPress platform: question answers strand the original run in input_required #778

Closed

Description

@chubes4

Problem

The question/actions/upload round trip in the WordPress platform plugin (#773) doesn't line up with what the WP side produces.

  • Nothing emits chat_input events. WpCodingAgents_Runtime_Chat only queues chat_message and chat_cancel, so handleInput() and the agents/claim-chat-run-input drain in wordpress-platform.mjs are unreachable in production.
  • In practice the answer arrives as a new agents/chat turn. That turn has a new run_id and claim token. handleTurn() swaps currentRun to the new run and delivers the answer. The original run is left in input_required forever: nothing finalizes it, and clients polling agents/get-chat-run for it see a permanently waiting run.

Target state

Pick one canonical answer path and make both sides agree.

  • Preferred: answers to an input_required run go through the agents-api queued-input contract that agents/claim-chat-run-input drains (WP_Agent_Chat_Run_Control::queue_message / can_queue_message). The WP side then wakes the runtime with a chat_input event for the same run, so a single run spans question → answer → completion.
  • If a new turn is the answer: the plugin finalizes or supersedes the previous run explicitly (status plus a linking event) before adopting the new one.

Check how agents/chat currently treats a message sent to a session whose run is waiting (agents-api #550, waiting-for status) before choosing.

Deliverable

A committed change with tests covering:

  • A question answered from a WP client resumes the session.
  • Every run ends in a terminal status.
  • chat_input (if kept) has a producer.

CHANGELOG and VERSION are release-owned and stay as they are.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions