diff --git a/apps/node-services/src/agent/AGENTS.md b/apps/node-services/src/agent/AGENTS.md index e0d0ee758..9f397e311 100644 --- a/apps/node-services/src/agent/AGENTS.md +++ b/apps/node-services/src/agent/AGENTS.md @@ -66,6 +66,12 @@ take precedence. cancellation, and the only Runtime execution path. Do not add a second scheduler, execution store, or Runtime executor beside it, and do not restore TeamHub Run admission. +- A Room Agent speaks only through TeamHub message writes, which the Computer + classifies as `message` activities (`reply-delivery.ts`). A Room Run whose + every write failed finishes failed with `reply_undelivered`. One that never + tried to write while a Human's Message that mentioned the Agent (a direct + chat always does) waits finishes failed with `reply_not_sent`. Its final + text is private scratch and is never posted for it. - Ordinary Room/Meta execution reads effective Agent configuration before a new Local Run. Skill saves do not activate idle Contexts. If versions changed, reuse graceful activation to resume the same native history; running/steered diff --git a/apps/node-services/src/agent/executor/provider.ts b/apps/node-services/src/agent/executor/provider.ts index dda556494..34e2d51c0 100644 --- a/apps/node-services/src/agent/executor/provider.ts +++ b/apps/node-services/src/agent/executor/provider.ts @@ -459,6 +459,7 @@ export interface RuntimeExecutionFailure { | "execution_failed" | "execution_outcome_unknown" | "reply_undelivered" + | "reply_not_sent" | "interrupted" | "computer_unavailable" | "cleanup_unconfirmed" diff --git a/apps/node-services/src/agent/executor/reply-delivery.ts b/apps/node-services/src/agent/executor/reply-delivery.ts index f93d8772e..8257ab5fc 100644 --- a/apps/node-services/src/agent/executor/reply-delivery.ts +++ b/apps/node-services/src/agent/executor/reply-delivery.ts @@ -1,19 +1,30 @@ +import { isRecord } from "@linger/service-kit"; import type { RunEvent } from "./provider.js"; +import type { Message } from "./types.js"; /** * The Run's TeamHub message calls, as the Computer classifies them: a * `message` activity is a message write (`teamhub message send` and its * siblings), `message_read` any other `teamhub message` call, and a command - * that exits non-zero finishes as failed. + * that exits non-zero finishes as failed. An emoji Reaction is a message + * write too. */ export class ReplyDelivery { readonly #started = new Map(); + #awaitingHuman = false; + #attemptedWrites = 0; #failedWrites = 0; #deliveredWrites = 0; #failedReads = 0; + /** Records the inputs the Run took up, at its start or as steers. */ + observeInputs(messages: readonly Message[]): void { + if (messages.some(awaitsReply)) this.#awaitingHuman = true; + } + observe(event: RunEvent): void { if (event.type === "activity.started") { + if (event.kind === "message") this.#attemptedWrites += 1; if (event.kind === "message" || event.kind === "message_read") this.#started.set(event.activityId, event.kind); return; @@ -39,6 +50,15 @@ export class ReplyDelivery { return this.#failedWrites > 0 && this.#deliveredWrites === 0; } + /** + * A Human who mentioned the Agent is waiting and the Agent never tried to + * post. Its Runtime ended the turn in text nobody sees; small models do + * this when they answer without calling the message command. + */ + get replyNotSent(): boolean { + return this.#awaitingHuman && this.#attemptedWrites === 0; + } + get hasFailures(): boolean { return this.#failedWrites > 0 || this.#failedReads > 0; } @@ -55,3 +75,23 @@ export class ReplyDelivery { }; } } + +/** + * Whether TeamHub queued this input for a Human's Message that mentioned this + * Agent. A direct chat mentions its Agent too. Room talk the Agent only reads + * along with, a Routine wake, a Task callback and another Agent's Message may + * rightly go unanswered. + */ +function awaitsReply(message: Message): boolean { + const notification = (message as unknown as Record) + .acceptedNotification; + if (!isRecord(notification) || !Array.isArray(notification.messages)) + return false; + return notification.messages.some( + (queued) => + isRecord(queued) && + queued.mentioned === true && + queued.authorType === "user" && + queued.messageKind === "conversation", + ); +} diff --git a/apps/node-services/src/agent/executor/run-loop.ts b/apps/node-services/src/agent/executor/run-loop.ts index cd9284ca2..b66d1d2e7 100644 --- a/apps/node-services/src/agent/executor/run-loop.ts +++ b/apps/node-services/src/agent/executor/run-loop.ts @@ -239,6 +239,7 @@ interface ActiveExecution { readonly runId: string; readonly sourceInboxIds: Set; readonly steerOperations: Set>; + readonly replyDelivery: ReplyDelivery; acceptingSteers: boolean; } @@ -1005,6 +1006,7 @@ export class RunLoop { ); } const replyDelivery = new ReplyDelivery(); + replyDelivery.observeInputs(execution.messages); let resumeStartRetries = 0; for (;;) { controller.signal.throwIfAborted(); @@ -1052,7 +1054,12 @@ export class RunLoop { execution.run = run; const providerReadyAt = performance.now(); this.#logProviderReady(execution, run, providerStartAt, providerReadyAt); - const active = await this.#activateExecution(execution, run, input); + const active = await this.#activateExecution( + execution, + run, + input, + replyDelivery, + ); execution.runtimeStatus ??= await this.#openRuntimeStatus( runId, @@ -1291,6 +1298,7 @@ export class RunLoop { execution: LocalRunExecution, run: AgentRun, input: AgentInput, + replyDelivery: ReplyDelivery, ): Promise { const { runId, controller } = execution; if ((await this.#state.getLocalRun(runId))?.cancellationRequested) { @@ -1322,6 +1330,7 @@ export class RunLoop { this.#activeExecution?.sourceInboxIds ?? new Set(execution.provenance.sourceInboxIds), steerOperations: new Set(), + replyDelivery, }; this.#activeExecution = active; execution.intent.resolveProviderReady(active); @@ -1717,19 +1726,19 @@ export class RunLoop { } /** - * A Room Agent speaks only through TeamHub message writes. When it tried to - * post and none landed, the Room has nothing to show, so a finished Provider - * turn is not a succeeded Run. Task Runs report through their final - * response and keep it. + * A Room Agent speaks only through TeamHub message writes, so a finished + * Provider turn is not a succeeded Run when the Room has nothing to show: + * the Agent tried to post and none landed, or a Human who mentioned it is + * waiting and it never tried. Its final text is private scratch and is not + * posted for it. Task Runs report through their final response and keep it. */ #completedTerminal( runId: string, finalResponse: string, replyDelivery: ReplyDelivery, ): LocalRunTerminal { - const undelivered = - this.#executionContextRef?.kind === "meta" && - replyDelivery.replyUndelivered; + const roomRun = this.#executionContextRef?.kind === "meta"; + const undelivered = roomRun && replyDelivery.replyUndelivered; if (replyDelivery.hasFailures) { this.#logger.log("warn", "local_run.teamhub_messages_failed", { runId, @@ -1738,14 +1747,26 @@ export class RunLoop { finalResponseLength: finalResponse.length, }); } - if (!undelivered) { - return { type: "succeeded", finalResponse }; + if (undelivered) { + return { + type: "failed", + error: "Agent reply was not delivered to the Room", + failure: runFailure("reply_undelivered", this.#runtimeType), + }; } - return { - type: "failed", - error: "Agent reply was not delivered to the Room", - failure: runFailure("reply_undelivered", this.#runtimeType), - }; + if (roomRun && replyDelivery.replyNotSent) { + this.#logger.log("warn", "local_run.reply_not_sent", { + runId, + ...replyDelivery.counts(), + finalResponseLength: finalResponse.length, + }); + return { + type: "failed", + error: "Agent ended its turn without sending a reply to the Room", + failure: runFailure("reply_not_sent", this.#runtimeType), + }; + } + return { type: "succeeded", finalResponse }; } #reportTerminal(runId: string, terminal: LocalTurnTerminal): void { @@ -1839,6 +1860,7 @@ export class RunLoop { target.sourceInboxIds.add(inboxId); } target.inputs.push(input); + target.replyDelivery.observeInputs(messages); this.#reportActiveRunContext({ runId: target.runId, sourceInboxIds: Object.freeze([...target.sourceInboxIds]), diff --git a/apps/node-services/tests/agent/executor/run-loop.test.ts b/apps/node-services/tests/agent/executor/run-loop.test.ts index 38efd7482..506f05b1b 100644 --- a/apps/node-services/tests/agent/executor/run-loop.test.ts +++ b/apps/node-services/tests/agent/executor/run-loop.test.ts @@ -332,6 +332,9 @@ describe("RunLoop", () => { const finishRun = async ( events: readonly RunEvent[], executionContextRef?: ExecutionContextRef, + input: Message = message("introduce yourself"), + finalResponse = "I could not deliver the reply: TeamHub returned 404.", + steered?: Message, ) => { const harness = createHarness( undefined, @@ -342,11 +345,19 @@ describe("RunLoop", () => { ); const run = new FakeRun(events); harness.provider.runs.push(run); - const runId = enqueue(harness.state, message("introduce yourself")); + const runId = enqueue(harness.state, input); try { harness.execution.start(); await vi.waitFor(() => expect(run.waitCalls).toBe(1)); - run.complete("I could not deliver the reply: TeamHub returned 404."); + if (steered) { + const steer = selectSteer(harness.state, steered); + await harness.execution.steer( + steer.groupId, + steer.messages, + new AbortController().signal, + ); + } + run.complete(finalResponse); await vi.waitFor(() => expect(harness.state.getLocalRun(runId)?.status).not.toBe("running"), ); @@ -424,6 +435,125 @@ describe("RunLoop", () => { ); }); + // TeamHub freezes each Inbox Message's sender, kind and whether it + // mentioned this Agent into the queued input. + const inboxInput = ( + inputId: string, + queued: { + readonly authorType: "agent" | "user"; + readonly messageKind: string; + readonly mentioned: boolean; + }, + ): Message => + ({ + ...message(inputId, "room:room-1"), + acceptedNotification: { + inboxId: "room:room-1", + after: "0", + through: "1", + targeted: queued.mentioned, + messages: [ + { + id: `${inputId}-message`, + body: "how are you?", + author: "Leo", + authorActorId: "actor-leo", + ...queued, + }, + ], + }, + }) as Message; + const humanMention = (inputId: string) => + inboxInput(inputId, { + authorType: "user", + messageKind: "conversation", + mentioned: true, + }); + + it("fails a Room Run that posted nothing while the Human who mentioned the Agent waits", async () => { + const { log, run } = await finishRun( + failedRead, + undefined, + humanMention("mention"), + "Doing well, you?", + ); + + expect(run).toMatchObject({ + status: "failed", + terminal: { + type: "failed", + failure: { code: "reply_not_sent", runtime_type: "pi" }, + }, + }); + expect(JSON.stringify(run?.terminal)).not.toContain("Doing well"); + expect(log).toHaveBeenCalledWith( + "warn", + "local_run.reply_not_sent", + expect.objectContaining({ + runId: run?.runId, + deliveredMessageWrites: 0, + finalResponseLength: "Doing well, you?".length, + }), + ); + }); + + it("fails a Room Run that posted nothing after a Human mention was steered into it", async () => { + const { run } = await finishRun( + [], + undefined, + inboxInput("room-talk", { + authorType: "user", + messageKind: "conversation", + mentioned: false, + }), + "", + humanMention("steered-mention"), + ); + + expect(run?.terminal).toMatchObject({ + type: "failed", + failure: { code: "reply_not_sent" }, + }); + }); + + it("keeps a Room Run succeeded when it answered a Human mention with a message", async () => { + const { run } = await finishRun( + messageWrite("send-1", "succeeded"), + undefined, + humanMention("mention"), + "", + ); + + expect(run?.terminal).toMatchObject({ type: "succeeded" }); + }); + + it.each([ + [ + "Room talk that did not mention the Agent", + { authorType: "user", messageKind: "conversation", mentioned: false }, + ], + [ + "a routine wake that mentions the Agent", + { authorType: "user", messageKind: "agent_runtime", mentioned: true }, + ], + [ + "another Agent's mention", + { authorType: "agent", messageKind: "conversation", mentioned: true }, + ], + ] as const)( + "keeps a Room Run that stayed silent on %s succeeded", + async (_label, queued) => { + const { run } = await finishRun( + [], + undefined, + inboxInput("wake", queued), + "Nothing to add.", + ); + + expect(run?.terminal).toMatchObject({ type: "succeeded" }); + }, + ); + it("leaves a Task Run, which reports through its final response, succeeded", async () => { const { run } = await finishRun(messageWrite("send-1", "failed"), { kind: "alter_ego", diff --git a/apps/teamhub/internal/agentruntimestate/runtime_failure.go b/apps/teamhub/internal/agentruntimestate/runtime_failure.go index fc7fd892e..bca77f325 100644 --- a/apps/teamhub/internal/agentruntimestate/runtime_failure.go +++ b/apps/teamhub/internal/agentruntimestate/runtime_failure.go @@ -32,7 +32,7 @@ func terminalRuntimeFailure(raw json.RawMessage) (*PublicRuntimeFailure, error) switch failure.Code { case "session_not_found", "protocol_incompatible", "authentication_required", "network_error", "rate_limited", "model_unavailable", "model_not_offered", "context_too_long", "model_service_error", "timeout", "execution_failed", - "execution_outcome_unknown", "reply_undelivered", "interrupted", "computer_unavailable", + "execution_outcome_unknown", "reply_undelivered", "reply_not_sent", "interrupted", "computer_unavailable", "cleanup_unconfirmed", "response_too_large", "unclassified": default: return nil, ErrInvalid diff --git a/apps/teamhub/internal/agentruntimestate/runtime_failure_test.go b/apps/teamhub/internal/agentruntimestate/runtime_failure_test.go index cb73f4de5..ff01465d2 100644 --- a/apps/teamhub/internal/agentruntimestate/runtime_failure_test.go +++ b/apps/teamhub/internal/agentruntimestate/runtime_failure_test.go @@ -13,6 +13,7 @@ func TestTerminalRuntimeFailure(t *testing.T) { {"legacy", `{"type":"failed","error":"private error"}`, true}, {"unknown execution outcome", `{"type":"failed","failure":{"code":"execution_outcome_unknown","runtime_type":"claude"}}`, true}, {"reply never reached the Room", `{"type":"failed","error":"Agent reply was not delivered to the Room","failure":{"code":"reply_undelivered","runtime_type":"pi"}}`, true}, + {"no reply sent to a waiting Human", `{"type":"failed","error":"Agent ended its turn without sending a reply to the Room","failure":{"code":"reply_not_sent","runtime_type":"pi"}}`, true}, {"model refused for the account", `{"type":"failed","failure":{"code":"model_unavailable","runtime_type":"codex","runtime_version":"0.153.4"}}`, true}, {"Computer does not offer the model", `{"type":"failed","error":"Local Computer model is unavailable","failure":{"code":"model_not_offered","runtime_type":"codex"}}`, true}, {"canceled cannot claim unknown failure", `{"type":"canceled","failure":{"code":"execution_outcome_unknown","runtime_type":"codex"}}`, false}, diff --git a/apps/web/src/features/rooms/runtime-status/runtime-failure-message.test.ts b/apps/web/src/features/rooms/runtime-status/runtime-failure-message.test.ts index 9ff99766b..93672bfdc 100644 --- a/apps/web/src/features/rooms/runtime-status/runtime-failure-message.test.ts +++ b/apps/web/src/features/rooms/runtime-status/runtime-failure-message.test.ts @@ -49,6 +49,16 @@ describe("Runtime failure messages", () => { expect(message).toContain("TeamHub"); }); + it("says the Agent finished without sending its reply", () => { + const message = runtimeFailureMessage({ + code: "reply_not_sent", + runtime_type: "pi", + }); + expect(message).toContain("Pi:"); + expect(message).toContain("finished without sending its reply"); + expect(message).toContain("choose a stronger model"); + }); + it("names a failure the Agent Service observed without a Runtime prefix", () => { expect(runtimeFailureMessage({ code: "interrupted" })).toMatch( /^The Run was interrupted before it finished/, diff --git a/apps/web/src/features/rooms/runtime-status/runtime-failure-message.ts b/apps/web/src/features/rooms/runtime-status/runtime-failure-message.ts index e1c6aebf0..f5278db27 100644 --- a/apps/web/src/features/rooms/runtime-status/runtime-failure-message.ts +++ b/apps/web/src/features/rooms/runtime-status/runtime-failure-message.ts @@ -27,6 +27,8 @@ const messages: Record = { "A command was dispatched, but its result could not be confirmed. It was not automatically replayed. Check its effects before retrying.", reply_undelivered: "The Agent finished, but its reply did not reach the Room because every TeamHub message it tried to send failed. Check the Agent's connection to TeamHub, then ask again.", + reply_not_sent: + "The Agent finished without sending its reply to the Room. Its model may have answered without using the message command. Ask again, or choose a stronger model for the Agent.", interrupted: "The Run was interrupted before it finished, for example by a restart or by stopping the Agent on its Computer. Part of its work may have taken effect; check the result before asking again.", computer_unavailable: diff --git a/contracts/generated/go/teamhubinternal/openapi.gen.go b/contracts/generated/go/teamhubinternal/openapi.gen.go index 297d3ea08..ced00238e 100644 --- a/contracts/generated/go/teamhubinternal/openapi.gen.go +++ b/contracts/generated/go/teamhubinternal/openapi.gen.go @@ -338,6 +338,7 @@ const ( NetworkError AgentRuntimeExecutionFailureCode = "network_error" ProtocolIncompatible AgentRuntimeExecutionFailureCode = "protocol_incompatible" RateLimited AgentRuntimeExecutionFailureCode = "rate_limited" + ReplyNotSent AgentRuntimeExecutionFailureCode = "reply_not_sent" ReplyUndelivered AgentRuntimeExecutionFailureCode = "reply_undelivered" ResponseTooLarge AgentRuntimeExecutionFailureCode = "response_too_large" SessionNotFound AgentRuntimeExecutionFailureCode = "session_not_found" @@ -374,6 +375,8 @@ func (e AgentRuntimeExecutionFailureCode) Valid() bool { return true case RateLimited: return true + case ReplyNotSent: + return true case ReplyUndelivered: return true case ResponseTooLarge: @@ -2405,7 +2408,7 @@ type AgentRuntimeDeletionSnapshot struct { TenantId Id `json:"tenant_id"` } -// AgentRuntimeExecutionFailure Public classified failure; contains no native error text, paths, credentials, or task input. Each code is set where the failure is observed, from structured signals only. model_unavailable means the model service refused the selected model for the Runtime's account, so the Agent needs another model or another sign-in. model_not_offered means the Agent's Computer does not offer the selected model for its Runtime, or the model does not support the selected reasoning effort, so the Runtime could not start; the Agent needs a model and reasoning effort that Computer offers. context_too_long means the conversation no longer fits the model's context window. model_service_error means the model service reported a server-side error. timeout means the Runtime hit its local execution deadline. execution_outcome_unknown means a command was dispatched but no validated exit was observed before unexpected transport or Runtime failure. Intentional cancellation, authorization loss or unavailability, and normal retirement do not create this classification. Authorization loss or unavailability includes explicit revocation, authorization checks that fail or time out, and authorization expiry. This code does not currently cover unknown effects caused by control-plane disconnection. It remains a failed Run and must not be automatically replayed; verify its effects before starting another Run. reply_undelivered means a Room Run finished, but every message the Agent tried to post failed, so the Room received no reply from it. interrupted means the Run stopped before it finished for a reason other than a user cancellation, such as a restart or a Runner stopped on its Computer; part of its work may have taken effect and it is not replayed. computer_unavailable means the Agent's Computer could not run it: the Computer is unreachable, the Agent's Runner is stopped there, or the Runtime is not enabled. cleanup_unconfirmed means the Runtime process could not be confirmed stopped. response_too_large means the reply exceeded the Room's size limit. unclassified means no structured signal identified the cause. runtime_type is present when the failure belongs to a selected Runtime; it is absent for failures the Agent Service or TeamHub observes without one. +// AgentRuntimeExecutionFailure Public classified failure; contains no native error text, paths, credentials, or task input. Each code is set where the failure is observed, from structured signals only. model_unavailable means the model service refused the selected model for the Runtime's account, so the Agent needs another model or another sign-in. model_not_offered means the Agent's Computer does not offer the selected model for its Runtime, or the model does not support the selected reasoning effort, so the Runtime could not start; the Agent needs a model and reasoning effort that Computer offers. context_too_long means the conversation no longer fits the model's context window. model_service_error means the model service reported a server-side error. timeout means the Runtime hit its local execution deadline. execution_outcome_unknown means a command was dispatched but no validated exit was observed before unexpected transport or Runtime failure. Intentional cancellation, authorization loss or unavailability, and normal retirement do not create this classification. Authorization loss or unavailability includes explicit revocation, authorization checks that fail or time out, and authorization expiry. This code does not currently cover unknown effects caused by control-plane disconnection. It remains a failed Run and must not be automatically replayed; verify its effects before starting another Run. reply_undelivered means a Room Run finished, but every message the Agent tried to post failed, so the Room received no reply from it. reply_not_sent means a Room Run finished without trying to post anything while a Human who mentioned the Agent waited for its reply; the Runtime ended the turn in text nobody sees, which is not posted for it. interrupted means the Run stopped before it finished for a reason other than a user cancellation, such as a restart or a Runner stopped on its Computer; part of its work may have taken effect and it is not replayed. computer_unavailable means the Agent's Computer could not run it: the Computer is unreachable, the Agent's Runner is stopped there, or the Runtime is not enabled. cleanup_unconfirmed means the Runtime process could not be confirmed stopped. response_too_large means the reply exceeded the Room's size limit. unclassified means no structured signal identified the cause. runtime_type is present when the failure belongs to a selected Runtime; it is absent for failures the Agent Service or TeamHub observes without one. type AgentRuntimeExecutionFailure struct { Code AgentRuntimeExecutionFailureCode `json:"code"` RuntimeType *LocalRuntimeType `json:"runtime_type,omitempty"` @@ -3091,7 +3094,7 @@ type FinishAgentLocalRunRequestTerminalType string // FinishAgentLocalRunRequest_Terminal defines model for FinishAgentLocalRunRequest.Terminal. type FinishAgentLocalRunRequest_Terminal struct { - // Failure Public classified failure; contains no native error text, paths, credentials, or task input. Each code is set where the failure is observed, from structured signals only. model_unavailable means the model service refused the selected model for the Runtime's account, so the Agent needs another model or another sign-in. model_not_offered means the Agent's Computer does not offer the selected model for its Runtime, or the model does not support the selected reasoning effort, so the Runtime could not start; the Agent needs a model and reasoning effort that Computer offers. context_too_long means the conversation no longer fits the model's context window. model_service_error means the model service reported a server-side error. timeout means the Runtime hit its local execution deadline. execution_outcome_unknown means a command was dispatched but no validated exit was observed before unexpected transport or Runtime failure. Intentional cancellation, authorization loss or unavailability, and normal retirement do not create this classification. Authorization loss or unavailability includes explicit revocation, authorization checks that fail or time out, and authorization expiry. This code does not currently cover unknown effects caused by control-plane disconnection. It remains a failed Run and must not be automatically replayed; verify its effects before starting another Run. reply_undelivered means a Room Run finished, but every message the Agent tried to post failed, so the Room received no reply from it. interrupted means the Run stopped before it finished for a reason other than a user cancellation, such as a restart or a Runner stopped on its Computer; part of its work may have taken effect and it is not replayed. computer_unavailable means the Agent's Computer could not run it: the Computer is unreachable, the Agent's Runner is stopped there, or the Runtime is not enabled. cleanup_unconfirmed means the Runtime process could not be confirmed stopped. response_too_large means the reply exceeded the Room's size limit. unclassified means no structured signal identified the cause. runtime_type is present when the failure belongs to a selected Runtime; it is absent for failures the Agent Service or TeamHub observes without one. + // Failure Public classified failure; contains no native error text, paths, credentials, or task input. Each code is set where the failure is observed, from structured signals only. model_unavailable means the model service refused the selected model for the Runtime's account, so the Agent needs another model or another sign-in. model_not_offered means the Agent's Computer does not offer the selected model for its Runtime, or the model does not support the selected reasoning effort, so the Runtime could not start; the Agent needs a model and reasoning effort that Computer offers. context_too_long means the conversation no longer fits the model's context window. model_service_error means the model service reported a server-side error. timeout means the Runtime hit its local execution deadline. execution_outcome_unknown means a command was dispatched but no validated exit was observed before unexpected transport or Runtime failure. Intentional cancellation, authorization loss or unavailability, and normal retirement do not create this classification. Authorization loss or unavailability includes explicit revocation, authorization checks that fail or time out, and authorization expiry. This code does not currently cover unknown effects caused by control-plane disconnection. It remains a failed Run and must not be automatically replayed; verify its effects before starting another Run. reply_undelivered means a Room Run finished, but every message the Agent tried to post failed, so the Room received no reply from it. reply_not_sent means a Room Run finished without trying to post anything while a Human who mentioned the Agent waited for its reply; the Runtime ended the turn in text nobody sees, which is not posted for it. interrupted means the Run stopped before it finished for a reason other than a user cancellation, such as a restart or a Runner stopped on its Computer; part of its work may have taken effect and it is not replayed. computer_unavailable means the Agent's Computer could not run it: the Computer is unreachable, the Agent's Runner is stopped there, or the Runtime is not enabled. cleanup_unconfirmed means the Runtime process could not be confirmed stopped. response_too_large means the reply exceeded the Room's size limit. unclassified means no structured signal identified the cause. runtime_type is present when the failure belongs to a selected Runtime; it is absent for failures the Agent Service or TeamHub observes without one. Failure *AgentRuntimeExecutionFailure `json:"failure,omitempty"` Type FinishAgentLocalRunRequestTerminalType `json:"type"` AdditionalProperties map[string]interface{} `json:"-"` diff --git a/contracts/generated/go/teamhubpublic/openapi.gen.go b/contracts/generated/go/teamhubpublic/openapi.gen.go index 9433ed27a..3ccb0c156 100644 --- a/contracts/generated/go/teamhubpublic/openapi.gen.go +++ b/contracts/generated/go/teamhubpublic/openapi.gen.go @@ -239,6 +239,7 @@ const ( AgentRuntimeExecutionFailureCodeNetworkError AgentRuntimeExecutionFailureCode = "network_error" AgentRuntimeExecutionFailureCodeProtocolIncompatible AgentRuntimeExecutionFailureCode = "protocol_incompatible" AgentRuntimeExecutionFailureCodeRateLimited AgentRuntimeExecutionFailureCode = "rate_limited" + AgentRuntimeExecutionFailureCodeReplyNotSent AgentRuntimeExecutionFailureCode = "reply_not_sent" AgentRuntimeExecutionFailureCodeReplyUndelivered AgentRuntimeExecutionFailureCode = "reply_undelivered" AgentRuntimeExecutionFailureCodeResponseTooLarge AgentRuntimeExecutionFailureCode = "response_too_large" AgentRuntimeExecutionFailureCodeSessionNotFound AgentRuntimeExecutionFailureCode = "session_not_found" @@ -275,6 +276,8 @@ func (e AgentRuntimeExecutionFailureCode) Valid() bool { return true case AgentRuntimeExecutionFailureCodeRateLimited: return true + case AgentRuntimeExecutionFailureCodeReplyNotSent: + return true case AgentRuntimeExecutionFailureCodeReplyUndelivered: return true case AgentRuntimeExecutionFailureCodeResponseTooLarge: @@ -4291,7 +4294,7 @@ type AgentRuntimeConfig struct { ReasoningEffort *AgentReasoningEffort `json:"reasoning_effort,omitempty"` } -// AgentRuntimeExecutionFailure Public classified failure; contains no native error text, paths, credentials, or task input. Each code is set where the failure is observed, from structured signals only. model_unavailable means the model service refused the selected model for the Runtime's account, so the Agent needs another model or another sign-in. model_not_offered means the Agent's Computer does not offer the selected model for its Runtime, or the model does not support the selected reasoning effort, so the Runtime could not start; the Agent needs a model and reasoning effort that Computer offers. context_too_long means the conversation no longer fits the model's context window. model_service_error means the model service reported a server-side error. timeout means the Runtime hit its local execution deadline. execution_outcome_unknown means a command was dispatched but no validated exit was observed before unexpected transport or Runtime failure. Intentional cancellation, authorization loss or unavailability, and normal retirement do not create this classification. Authorization loss or unavailability includes explicit revocation, authorization checks that fail or time out, and authorization expiry. This code does not currently cover unknown effects caused by control-plane disconnection. It remains a failed Run and must not be automatically replayed; verify its effects before starting another Run. reply_undelivered means a Room Run finished, but every message the Agent tried to post failed, so the Room received no reply from it. interrupted means the Run stopped before it finished for a reason other than a user cancellation, such as a restart or a Runner stopped on its Computer; part of its work may have taken effect and it is not replayed. computer_unavailable means the Agent's Computer could not run it: the Computer is unreachable, the Agent's Runner is stopped there, or the Runtime is not enabled. cleanup_unconfirmed means the Runtime process could not be confirmed stopped. response_too_large means the reply exceeded the Room's size limit. unclassified means no structured signal identified the cause. runtime_type is present when the failure belongs to a selected Runtime; it is absent for failures the Agent Service or TeamHub observes without one. +// AgentRuntimeExecutionFailure Public classified failure; contains no native error text, paths, credentials, or task input. Each code is set where the failure is observed, from structured signals only. model_unavailable means the model service refused the selected model for the Runtime's account, so the Agent needs another model or another sign-in. model_not_offered means the Agent's Computer does not offer the selected model for its Runtime, or the model does not support the selected reasoning effort, so the Runtime could not start; the Agent needs a model and reasoning effort that Computer offers. context_too_long means the conversation no longer fits the model's context window. model_service_error means the model service reported a server-side error. timeout means the Runtime hit its local execution deadline. execution_outcome_unknown means a command was dispatched but no validated exit was observed before unexpected transport or Runtime failure. Intentional cancellation, authorization loss or unavailability, and normal retirement do not create this classification. Authorization loss or unavailability includes explicit revocation, authorization checks that fail or time out, and authorization expiry. This code does not currently cover unknown effects caused by control-plane disconnection. It remains a failed Run and must not be automatically replayed; verify its effects before starting another Run. reply_undelivered means a Room Run finished, but every message the Agent tried to post failed, so the Room received no reply from it. reply_not_sent means a Room Run finished without trying to post anything while a Human who mentioned the Agent waited for its reply; the Runtime ended the turn in text nobody sees, which is not posted for it. interrupted means the Run stopped before it finished for a reason other than a user cancellation, such as a restart or a Runner stopped on its Computer; part of its work may have taken effect and it is not replayed. computer_unavailable means the Agent's Computer could not run it: the Computer is unreachable, the Agent's Runner is stopped there, or the Runtime is not enabled. cleanup_unconfirmed means the Runtime process could not be confirmed stopped. response_too_large means the reply exceeded the Room's size limit. unclassified means no structured signal identified the cause. runtime_type is present when the failure belongs to a selected Runtime; it is absent for failures the Agent Service or TeamHub observes without one. type AgentRuntimeExecutionFailure struct { Code AgentRuntimeExecutionFailureCode `json:"code"` RuntimeType *LocalRuntimeType `json:"runtime_type,omitempty"` @@ -4360,7 +4363,7 @@ type AgentRuntimePresentationOutputCreatedEventSurface string // AgentRuntimeStoppedStatusChangedEvent defines model for AgentRuntimeStoppedStatusChangedEvent. type AgentRuntimeStoppedStatusChangedEvent struct { - // Failure Public classified failure; contains no native error text, paths, credentials, or task input. Each code is set where the failure is observed, from structured signals only. model_unavailable means the model service refused the selected model for the Runtime's account, so the Agent needs another model or another sign-in. model_not_offered means the Agent's Computer does not offer the selected model for its Runtime, or the model does not support the selected reasoning effort, so the Runtime could not start; the Agent needs a model and reasoning effort that Computer offers. context_too_long means the conversation no longer fits the model's context window. model_service_error means the model service reported a server-side error. timeout means the Runtime hit its local execution deadline. execution_outcome_unknown means a command was dispatched but no validated exit was observed before unexpected transport or Runtime failure. Intentional cancellation, authorization loss or unavailability, and normal retirement do not create this classification. Authorization loss or unavailability includes explicit revocation, authorization checks that fail or time out, and authorization expiry. This code does not currently cover unknown effects caused by control-plane disconnection. It remains a failed Run and must not be automatically replayed; verify its effects before starting another Run. reply_undelivered means a Room Run finished, but every message the Agent tried to post failed, so the Room received no reply from it. interrupted means the Run stopped before it finished for a reason other than a user cancellation, such as a restart or a Runner stopped on its Computer; part of its work may have taken effect and it is not replayed. computer_unavailable means the Agent's Computer could not run it: the Computer is unreachable, the Agent's Runner is stopped there, or the Runtime is not enabled. cleanup_unconfirmed means the Runtime process could not be confirmed stopped. response_too_large means the reply exceeded the Room's size limit. unclassified means no structured signal identified the cause. runtime_type is present when the failure belongs to a selected Runtime; it is absent for failures the Agent Service or TeamHub observes without one. + // Failure Public classified failure; contains no native error text, paths, credentials, or task input. Each code is set where the failure is observed, from structured signals only. model_unavailable means the model service refused the selected model for the Runtime's account, so the Agent needs another model or another sign-in. model_not_offered means the Agent's Computer does not offer the selected model for its Runtime, or the model does not support the selected reasoning effort, so the Runtime could not start; the Agent needs a model and reasoning effort that Computer offers. context_too_long means the conversation no longer fits the model's context window. model_service_error means the model service reported a server-side error. timeout means the Runtime hit its local execution deadline. execution_outcome_unknown means a command was dispatched but no validated exit was observed before unexpected transport or Runtime failure. Intentional cancellation, authorization loss or unavailability, and normal retirement do not create this classification. Authorization loss or unavailability includes explicit revocation, authorization checks that fail or time out, and authorization expiry. This code does not currently cover unknown effects caused by control-plane disconnection. It remains a failed Run and must not be automatically replayed; verify its effects before starting another Run. reply_undelivered means a Room Run finished, but every message the Agent tried to post failed, so the Room received no reply from it. reply_not_sent means a Room Run finished without trying to post anything while a Human who mentioned the Agent waited for its reply; the Runtime ended the turn in text nobody sees, which is not posted for it. interrupted means the Run stopped before it finished for a reason other than a user cancellation, such as a restart or a Runner stopped on its Computer; part of its work may have taken effect and it is not replayed. computer_unavailable means the Agent's Computer could not run it: the Computer is unreachable, the Agent's Runner is stopped there, or the Runtime is not enabled. cleanup_unconfirmed means the Runtime process could not be confirmed stopped. response_too_large means the reply exceeded the Room's size limit. unclassified means no structured signal identified the cause. runtime_type is present when the failure belongs to a selected Runtime; it is absent for failures the Agent Service or TeamHub observes without one. Failure *AgentRuntimeExecutionFailure `json:"failure,omitempty"` Outcome AgentRuntimeStoppedStatusChangedEventOutcome `json:"outcome"` Status string `json:"status"` diff --git a/contracts/generated/typescript/src/generated/teamhub-internal/types.ts b/contracts/generated/typescript/src/generated/teamhub-internal/types.ts index 4d147fc9e..e722f541a 100644 --- a/contracts/generated/typescript/src/generated/teamhub-internal/types.ts +++ b/contracts/generated/typescript/src/generated/teamhub-internal/types.ts @@ -2107,7 +2107,7 @@ export interface components { AgentRuntimeSuccessResult: { success: boolean; }; - /** @description Public classified failure; contains no native error text, paths, credentials, or task input. Each code is set where the failure is observed, from structured signals only. model_unavailable means the model service refused the selected model for the Runtime's account, so the Agent needs another model or another sign-in. model_not_offered means the Agent's Computer does not offer the selected model for its Runtime, or the model does not support the selected reasoning effort, so the Runtime could not start; the Agent needs a model and reasoning effort that Computer offers. context_too_long means the conversation no longer fits the model's context window. model_service_error means the model service reported a server-side error. timeout means the Runtime hit its local execution deadline. execution_outcome_unknown means a command was dispatched but no validated exit was observed before unexpected transport or Runtime failure. Intentional cancellation, authorization loss or unavailability, and normal retirement do not create this classification. Authorization loss or unavailability includes explicit revocation, authorization checks that fail or time out, and authorization expiry. This code does not currently cover unknown effects caused by control-plane disconnection. It remains a failed Run and must not be automatically replayed; verify its effects before starting another Run. reply_undelivered means a Room Run finished, but every message the Agent tried to post failed, so the Room received no reply from it. interrupted means the Run stopped before it finished for a reason other than a user cancellation, such as a restart or a Runner stopped on its Computer; part of its work may have taken effect and it is not replayed. computer_unavailable means the Agent's Computer could not run it: the Computer is unreachable, the Agent's Runner is stopped there, or the Runtime is not enabled. cleanup_unconfirmed means the Runtime process could not be confirmed stopped. response_too_large means the reply exceeded the Room's size limit. unclassified means no structured signal identified the cause. runtime_type is present when the failure belongs to a selected Runtime; it is absent for failures the Agent Service or TeamHub observes without one. */ + /** @description Public classified failure; contains no native error text, paths, credentials, or task input. Each code is set where the failure is observed, from structured signals only. model_unavailable means the model service refused the selected model for the Runtime's account, so the Agent needs another model or another sign-in. model_not_offered means the Agent's Computer does not offer the selected model for its Runtime, or the model does not support the selected reasoning effort, so the Runtime could not start; the Agent needs a model and reasoning effort that Computer offers. context_too_long means the conversation no longer fits the model's context window. model_service_error means the model service reported a server-side error. timeout means the Runtime hit its local execution deadline. execution_outcome_unknown means a command was dispatched but no validated exit was observed before unexpected transport or Runtime failure. Intentional cancellation, authorization loss or unavailability, and normal retirement do not create this classification. Authorization loss or unavailability includes explicit revocation, authorization checks that fail or time out, and authorization expiry. This code does not currently cover unknown effects caused by control-plane disconnection. It remains a failed Run and must not be automatically replayed; verify its effects before starting another Run. reply_undelivered means a Room Run finished, but every message the Agent tried to post failed, so the Room received no reply from it. reply_not_sent means a Room Run finished without trying to post anything while a Human who mentioned the Agent waited for its reply; the Runtime ended the turn in text nobody sees, which is not posted for it. interrupted means the Run stopped before it finished for a reason other than a user cancellation, such as a restart or a Runner stopped on its Computer; part of its work may have taken effect and it is not replayed. computer_unavailable means the Agent's Computer could not run it: the Computer is unreachable, the Agent's Runner is stopped there, or the Runtime is not enabled. cleanup_unconfirmed means the Runtime process could not be confirmed stopped. response_too_large means the reply exceeded the Room's size limit. unclassified means no structured signal identified the cause. runtime_type is present when the failure belongs to a selected Runtime; it is absent for failures the Agent Service or TeamHub observes without one. */ AgentRuntimeExecutionFailure: { /** @enum {string} */ code: @@ -2124,6 +2124,7 @@ export interface components { | "execution_failed" | "execution_outcome_unknown" | "reply_undelivered" + | "reply_not_sent" | "interrupted" | "computer_unavailable" | "cleanup_unconfirmed" diff --git a/contracts/generated/typescript/src/generated/teamhub-public/types.ts b/contracts/generated/typescript/src/generated/teamhub-public/types.ts index 4ca8e5d4c..1edc6e98e 100644 --- a/contracts/generated/typescript/src/generated/teamhub-public/types.ts +++ b/contracts/generated/typescript/src/generated/teamhub-public/types.ts @@ -6201,7 +6201,7 @@ export interface components { /** @description Optional public queue label for queued, or the full provider-visible reasoning summary title for thinking. Omit for working; raw reasoning is never allowed. */ title?: string; }; - /** @description Public classified failure; contains no native error text, paths, credentials, or task input. Each code is set where the failure is observed, from structured signals only. model_unavailable means the model service refused the selected model for the Runtime's account, so the Agent needs another model or another sign-in. model_not_offered means the Agent's Computer does not offer the selected model for its Runtime, or the model does not support the selected reasoning effort, so the Runtime could not start; the Agent needs a model and reasoning effort that Computer offers. context_too_long means the conversation no longer fits the model's context window. model_service_error means the model service reported a server-side error. timeout means the Runtime hit its local execution deadline. execution_outcome_unknown means a command was dispatched but no validated exit was observed before unexpected transport or Runtime failure. Intentional cancellation, authorization loss or unavailability, and normal retirement do not create this classification. Authorization loss or unavailability includes explicit revocation, authorization checks that fail or time out, and authorization expiry. This code does not currently cover unknown effects caused by control-plane disconnection. It remains a failed Run and must not be automatically replayed; verify its effects before starting another Run. reply_undelivered means a Room Run finished, but every message the Agent tried to post failed, so the Room received no reply from it. interrupted means the Run stopped before it finished for a reason other than a user cancellation, such as a restart or a Runner stopped on its Computer; part of its work may have taken effect and it is not replayed. computer_unavailable means the Agent's Computer could not run it: the Computer is unreachable, the Agent's Runner is stopped there, or the Runtime is not enabled. cleanup_unconfirmed means the Runtime process could not be confirmed stopped. response_too_large means the reply exceeded the Room's size limit. unclassified means no structured signal identified the cause. runtime_type is present when the failure belongs to a selected Runtime; it is absent for failures the Agent Service or TeamHub observes without one. */ + /** @description Public classified failure; contains no native error text, paths, credentials, or task input. Each code is set where the failure is observed, from structured signals only. model_unavailable means the model service refused the selected model for the Runtime's account, so the Agent needs another model or another sign-in. model_not_offered means the Agent's Computer does not offer the selected model for its Runtime, or the model does not support the selected reasoning effort, so the Runtime could not start; the Agent needs a model and reasoning effort that Computer offers. context_too_long means the conversation no longer fits the model's context window. model_service_error means the model service reported a server-side error. timeout means the Runtime hit its local execution deadline. execution_outcome_unknown means a command was dispatched but no validated exit was observed before unexpected transport or Runtime failure. Intentional cancellation, authorization loss or unavailability, and normal retirement do not create this classification. Authorization loss or unavailability includes explicit revocation, authorization checks that fail or time out, and authorization expiry. This code does not currently cover unknown effects caused by control-plane disconnection. It remains a failed Run and must not be automatically replayed; verify its effects before starting another Run. reply_undelivered means a Room Run finished, but every message the Agent tried to post failed, so the Room received no reply from it. reply_not_sent means a Room Run finished without trying to post anything while a Human who mentioned the Agent waited for its reply; the Runtime ended the turn in text nobody sees, which is not posted for it. interrupted means the Run stopped before it finished for a reason other than a user cancellation, such as a restart or a Runner stopped on its Computer; part of its work may have taken effect and it is not replayed. computer_unavailable means the Agent's Computer could not run it: the Computer is unreachable, the Agent's Runner is stopped there, or the Runtime is not enabled. cleanup_unconfirmed means the Runtime process could not be confirmed stopped. response_too_large means the reply exceeded the Room's size limit. unclassified means no structured signal identified the cause. runtime_type is present when the failure belongs to a selected Runtime; it is absent for failures the Agent Service or TeamHub observes without one. */ AgentRuntimeExecutionFailure: { /** @enum {string} */ code: @@ -6218,6 +6218,7 @@ export interface components { | "execution_failed" | "execution_outcome_unknown" | "reply_undelivered" + | "reply_not_sent" | "interrupted" | "computer_unavailable" | "cleanup_unconfirmed" diff --git a/contracts/openapi/components/agent-runtime-state.yaml b/contracts/openapi/components/agent-runtime-state.yaml index d35bb9676..3a9db3248 100644 --- a/contracts/openapi/components/agent-runtime-state.yaml +++ b/contracts/openapi/components/agent-runtime-state.yaml @@ -1076,6 +1076,9 @@ components: It remains a failed Run and must not be automatically replayed; verify its effects before starting another Run. reply_undelivered means a Room Run finished, but every message the Agent tried to post failed, so the Room received no reply from it. + reply_not_sent means a Room Run finished without trying to post anything while a + Human who mentioned the Agent waited for its reply; the Runtime ended the turn in + text nobody sees, which is not posted for it. interrupted means the Run stopped before it finished for a reason other than a user cancellation, such as a restart or a Runner stopped on its Computer; part of its work may have taken effect and it is not replayed. @@ -1104,6 +1107,7 @@ components: execution_failed, execution_outcome_unknown, reply_undelivered, + reply_not_sent, interrupted, computer_unavailable, cleanup_unconfirmed,