Repository navigation
Conversation
…ies into it (#4537) A person asks an agent in chat to "ask X and tell me what it said". The agent delegates asynchronously and replies that it will report back. The wake turn then ran cut off from that conversation at both ends: its frame carried only the callee's ending, so the agent had lost the request and its own plan, and its reply stayed on the execution row, so the person never saw it. The wake frame now quotes the delegating turn, read off the link the callee row already records (continues_execution_id): what the agent was asked and what it replied then. A wake that delegates again links the next callee to the wake itself, so the request is read from the head of that chain and the plan from the turn that delegated last. Every row on the way must be the delegator's own; the text is sanitized and capped. When the head of the chain is a person's turn in an agent chat thread, the wake's reply is written into that thread as the agent's next message. It is written at the wake row's own terminal, which every terminal writer reaches, once per wake, on SUCCESS only, and announced with the existing thin chat_response_ready trigger. The open ChatPanel refetches its session in place on that trigger. The Chat tab sends /task, which never named its thread on the row, so persist_chat_session now does, after its own messages are saved. Workspace, Slack and Telegram conversations are unchanged: a delegated run already reports into those through its inherited channel context. Fixes #4537 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
merge-train (2026-11-17): not on this train — the frontend half needs work. Validated at The backend half is strong: the 17 tests drive Findings, all in the frontend half:
2 and 3 are the symptom #4537 reports surviving on two paths, which is why this does not ride. Smaller: Scope note for when it comes back: #4537 also names wakes on an answered ask ( Rides the next train once fixed; |
Summary
A wake turn was cut off from the conversation that caused it, at both ends (#4537, found in v1.0.5 testing, row A5):
How
caller_wake_service._delegating_turnsfollowscontinues_execution_id(already written by ent#1225) from the callee row. The first row is the turn that delegated (its reply is the plan). The chain is followed through platform continuations to the turn at its head, whose message is the request, so round two of a delegate→wake loop still reads the person's request. At most 8 hops, and every row must be the delegator's own. Text is sanitized and capped from the end._post_wake_replyruns at the wake row's own terminal (the hook_drain_missedalready uses, reached by every terminal writer). SUCCESS only, once per wake (idempotency keycaller_wake_reply:{wake_id}, released if the write fails).source_user_id, nosource_agent_name) and the session is that person's thread of that agent.chat_persistence_service.persist_chat_sessionnow names the thread on the row (chat_session_id)./chatalready did (bug: a watchdog-recovered chat turn never writes its assistant message — row says SUCCESS, thread shows nothing #3380); the Chat tab sends/task, which did not.chat_response_readytrigger (identifiers only).ChatPanelrefetches the session it shows, in place, and only when it grew.No schema change: both columns exist.
Not changed
channel_completion_report). The wake's own reply is not posted there. Stamping a destination on the wake changes who the turn is for (feat(workspace): Discuss and Dismiss on asks (abilityai/trinity-enterprise#747, #748) #3181 review F1), so that is left for its own change./taskturn is saved posts nothing: the thread is named on the row only once that turn's own messages are written.Test Plan
cd tests && pytest unit/test_4537_wake_conversation.py— 17 passedtest_4536_wake_window,test_ent1102_caller_wake,test_4357_wake_chain_depth,test_ent1216_wake_turn_reads,test_ent1225_continuation_tier,test_1444_chat_session_persistence,test_2329_pull_delivery_parity, and others) — 393 passedvite buildsucceedsPOST /api/agents/{name}/executions/{id}/result), put the reply in the thread once (a repeated callback added nothing) and onechat_response_readyevent arrived on/wsFixes #4537
🤖 Generated with Claude Code