Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/billing-web/src/checkout/payVerdict.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('payVerdictOf', () => {
},
{
name: 'a stale subscription quote',
result: refusedWith('REQUEST_FAILED', 'SUBSCRIPTION_QUOTE_STALE'),
result: { status: 'error', code: 'QUOTE_STALE' },
expected: { kind: 'requote', because: 'quote_expired' }
},
{
Expand Down
7 changes: 3 additions & 4 deletions apps/billing-web/src/checkout/payVerdict.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import {
import type { InlineOutcome, OperationOutcome } from '@/checkout/checkoutPage'

/** The server refused the quote the customer consented to; re-price before asking again. */
const STALE_QUOTE_SERVER_CODES = [
'PRORATION_QUOTE_EXPIRED',
'SUBSCRIPTION_QUOTE_STALE'
] as const
const STALE_QUOTE_SERVER_CODES = ['PRORATION_QUOTE_EXPIRED'] as const

/**
* What a Pay's result asks of the page. `settled` needs nothing from
Expand All @@ -39,6 +36,8 @@ export function payVerdictOf(result: SubscriptionCommandResult): PayVerdict {
)
return { kind: 'requote', because: 'quote_expired' }
switch (result.code) {
case 'QUOTE_STALE':
return { kind: 'requote', because: 'quote_expired' }
case 'REACTIVATION_CONFIRMATION_REQUIRED':
return { kind: 'requote', because: 'reactivation_required' }
case 'OPERATION_ALREADY_PENDING':
Expand Down
9 changes: 1 addition & 8 deletions apps/billing-web/src/views/FullPageCheckoutView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2169,14 +2169,7 @@ describe('FullPageCheckoutView promo codes', () => {
it('a code that lapsed before Pay: back to capture, chip gone, the expired card instead of a decline', async () => {
const fake = await renderCheckout(
{
subscribe: {
status: 'error',
code: 'REQUEST_FAILED',
serverCode: readBillingErrorCode({
code: 'SUBSCRIPTION_QUOTE_STALE',
message: 'stale'
})
}
subscribe: { status: 'error', code: 'QUOTE_STALE' }
},
quotesByCode
)
Expand Down
4 changes: 2 additions & 2 deletions apps/website/src/config/router-providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export interface RouterProviderCoverageRow {
const DOCS_MODELS_URL = 'https://docs.comfy.org/development/comfy-router/models'

/** The day the rows and the catalog size were last checked against the docs. */
export const ROUTER_PROVIDER_COVERAGE_VERIFIED_AT = '2026-09-25'
export const ROUTER_PROVIDER_COVERAGE_VERIFIED_AT = '2026-09-30'

/** How many models the Router catalog lists, all served by Comfy. */
export const ROUTER_CATALOG_MODEL_COUNT = 212
export const ROUTER_CATALOG_MODEL_COUNT = 213

/** In the order the page shows them: alphabetical by `name`. */
export const ROUTER_PROVIDER_COVERAGE: readonly RouterProviderCoverageRow[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,14 @@ test(
tool_calls: [
{
id: 'call-1',
tool_call_id: 'call-1',
tool_name: 'search_nodes',
status: 'ok',
status: 'success',
duration_ms: 420
},
{
// Deliberately 'success' (not 'ok', like call-1) to cover both terminal vocabularies.
id: 'call-2',
tool_call_id: 'call-2',
tool_name: 'add_node',
status: 'success',
duration_ms: 180
Expand Down
1 change: 1 addition & 0 deletions packages/ingest-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,7 @@ export type {
TeamCreditStopPrice,
TeamCreditStops,
TeamCreditStopSummary,
ToolCallSummary,
UpdateAssetData,
UpdateAssetError,
UpdateAssetErrors,
Expand Down
34 changes: 32 additions & 2 deletions packages/ingest-types/src/types.gen.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions packages/ingest-types/src/zod.gen.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 38 additions & 24 deletions src/workbench/extensions/agent/schemas/agentApiSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
zAgentRunMode as zGeneratedAgentRunMode,
zAgentThreadListResponse as zGeneratedAgentThreadListResponse,
zAgentTurnAccepted as zGeneratedAgentTurnAccepted,
zToolCallSummary,
zWorkflowListResponse
} from '@comfyorg/ingest-types/zod'
import type {
Expand Down Expand Up @@ -97,37 +98,50 @@ export type AgentRunModeValue = AgentRunModePreference['mode']
/**
* One entry of a persisted assistant row's `content.tool_calls` (see
* `agentTranscript.ts`'s `parseToolCallEntry`), the reload-path counterpart
* to the live WebSocket's `zAgentToolCallData` above. `status` is
* deliberately `z.string()` rather than a closed enum: an unrecognized value
* must still surface as a failed `ToolPart` (`toolCallOk` treats anything
* other than `pending`/`running`/`ok`/`success` as failure), so schema
* validation should reject a malformed *entry* (missing `id`/`tool_name`),
* not an unfamiliar *status* string or a bad `duration_ms` — `duration_ms` is
* `z.unknown().optional()` so a NaN/Infinity/negative value there doesn't
* sink the whole entry; `parseToolCallEntry` narrows it separately and just
* omits it. `status` is likewise `.optional()`: an entry that omits it
* entirely must still survive validation (`toolCallPartState`/`toolCallOk`
* already treat `undefined` as terminal-and-failed, matching the old
* parser's behavior for a status-less call).
* to the live WebSocket's `zAgentToolCallData` above. Sourced from the
* generated `ToolCallSummary` schema (Comfy-Org/cloud#10360), but relaxed:
* the generated schema requires `tool_call_id`, narrows `status` to the
* closed `'success' | 'error'` wire vocabulary, and requires `duration_ms`
* to be an integer, which is only true for rows persisted after that
* backend change landed. Real historical rows can still carry a bare `id`
* with no `tool_call_id`, a `status` of `'ok'` (an older success alias —
* see `toolCallOk` in `agentTranscript.ts`), or a non-integer `duration_ms`.
* `parseToolCallEntry` picks only the fields it actually reads from this,
* so an unrelated field (e.g. a strict `started_at`/`finished_at` datetime)
* never gates the entry.
*/
export const zPersistedToolCallSummary = z
export const zPersistedToolCallSummary = zToolCallSummary.extend({
id: z.string(),
tool_call_id: z.string().optional(),
status: z.string(),
duration_ms: z.number().optional()
})

/**
* The message-parse boundary's `content.tool_calls` field is deliberately
* `z.array(z.unknown())`, not the stricter `zPersistedToolCallSummary`
* above: `agentRestClient.ts`'s `request()` calls `.parse()` (throws) on
* the whole `AgentMessages` array, so a single non-conforming historical
* tool-call row must never fail the entire conversation-history load.
* `agentTranscript.ts`'s `parseToolCallEntry` runs its own `safeParse`
* per entry and degrades just that one row instead.
*
* The generated `AgentMessage.content` schema also keeps a
* `[key: string]: unknown` index signature on its TS type but no matching
* `.passthrough()` on its zod schema — the `.passthrough()` below re-widens
* it so a persisted row's other `content` fields (`text`, `attachments`,
* `attachment_refs`, `workflow_references`, ...; see `agentTranscript.ts`)
* keep parsing.
*/
const zAgentMessageContent = z
.object({
id: z.string(),
// The provider tool-use id a LIVE `agent_tool_call` frame carries as
// `tool_call_id` (see `zAgentToolCallData` above). `parseToolCallEntry`
// prefers this over `id` when building `callId` so a restored `ToolPart`
// is keyed the same way a live frame for the same call will be, and can
// be updated in place rather than rendered as an unmatched duplicate.
// Optional: rows recorded before `tool_call_id` existed have none.
tool_call_id: z.string().optional(),
tool_name: z.string(),
status: z.string().optional(),
duration_ms: z.unknown().optional()
tool_calls: z.array(z.unknown()).optional()
})
.passthrough()

export const zAgentMessage = zGeneratedAgentMessage
.extend({
content: zAgentMessageContent.optional(),
pending_ask: zAgentPendingAsk.optional()
})
.passthrough()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ describe('agentEventTransport text and tool parts', () => {
id: 'audit-row-uuid-1',
tool_call_id: 'call-1',
tool_name: 'run',
status: 'running'
status: 'error'
}
]
}
Expand Down
Loading
Loading