Repository navigation
Description
Summary
#4173 lets a turn read, by id, its own run and the runs it started, and lets the wake read the result it was woken for. Two cases stay open after it:
- A later turn of the same person cannot read a run an earlier turn of theirs started, when that run is on an agent the person cannot open.
- On a public link, the result of a delegated run that ends after the visitor's turn never reaches the visitor's chat. The wake runs and reads the result, and its reply stays on the wake's own run.
Part (a): a later turn of a person with an account
What happens. A person the agent is shared with asks the agent for work that the agent delegates to a second agent the person cannot open. The agent answers "started". In the next message the person asks "is it done?". That is a new turn. get_execution_result for the delegated run answers "Execution not found" (with the narrowed note), because the new turn did not start the run and the person cannot open the second agent. The agent can only say "still running".
Why. The delegated run's row records the person (source_user_id) and the calling agent (source_agent_name). A key acting for a person reads that person's rows only on an agent the person can open (dependencies.viewer_row_scope). #4173's exception is keyed on the turn that dispatched the run, so it does not carry over to a later turn.
Needs the operator's ruling. A rule here widens "the person must be able to open the agent". Proposed, for the ruling:
- an agent key acting in a running turn for a person with an account reads, by id, a run that the key's own agent dispatched for that same person in an earlier turn;
- result only (status, response, error): no
/log, no/stream, no fan-out batch; - everything else as in Agent cannot read a child execution it started during a share holder's turn (404 Execution not found) #4173: lists stay narrowed,
terminatekeeps its rule, an owner turn's id opens nothing.
Questions for the ruling:
- Is result-only the right line, given Agent cannot read a child execution it started during a share holder's turn (404 Execution not found) #4173 gave the dispatching turn the transcript too?
- Does it hold for a Workspace turn, whose row carries the person's email and no user id?
- A room turn and a visitor's turn have no person on the row. Confirm they stay out of part (a).
Part (b): the result on a public link
What happens. A visitor on a public link asks for work the agent delegates with an async call. The receipt says a wake will come (wake: "on_ending"), so the agent ends its turn, as the delegation contract tells it to. The run ends, the wake turn starts and reads the result. The visitor's page still ends at the agent's first reply.
Why (read in the code on dev).
- A wake's reply is written only into an agent chat thread of a person with an account:
caller_wake_service._reply_threadreturns no thread when the delegating turn has nosource_user_id. - A delegated run's own report-back covers Slack, Telegram and the Workspace only (
channel_completion_report._CHANNEL_RESOLVERS). A public-link turn carries no channel chat id.
So nothing brings a result that arrives after the turn back to a public-link chat.
Options.
- The wake's reply is written into the public chat session the delegation came from, and the page shows it.
- Or the receipt tells the agent the truth for such a turn: no wake will reach this conversation (
wake: "none"with a reason of its own), so the agent waits inside the turn and reads the result withget_execution_result. That read works since Agent cannot read a child execution it started during a share holder's turn (404 Execution not found) #4173.
Option 2 is the smaller change. Option 1 is the better outcome for long runs, which outlive a turn.
Part (c): the rule until then
In a visitor's turn on a public link, read the result before the turn ends: pass wake: false and poll get_execution_result. This is in the user doc since #4173 (docs/user-docs/collaboration/agent-network.md).
Acceptance criteria
- Part (a) has a recorded ruling, and either a rule with tests for each refusal or a stated "no" in
docs/memory/architecture/security.md. - On a public link, a delegated result that arrives after the turn either appears in the visitor's chat, or the receipt of that turn says no wake will reach the conversation.
- The delegation contract and the user doc say what a visitor's turn should do, and it matches the code.
- Tests reach the line that decides each case (a later turn; a public-link wake).
Out of scope
- The list view for Workspace and room turns (question 3 on Agent cannot read a child execution it started during a share holder's turn (404 Execution not found) #4173, not ruled).
- A later turn of a visitor reading an earlier turn's run. A run a visitor's turn starts records no person and no email today.
terminatefor a run a turn started.
Activity