diff --git a/scripts/sync-acr-contracts.mjs b/scripts/sync-acr-contracts.mjs index 665bcea..e08fb7d 100644 --- a/scripts/sync-acr-contracts.mjs +++ b/scripts/sync-acr-contracts.mjs @@ -449,7 +449,8 @@ const ARTIFACT_ROOT = path.join(ROOT, "src/contracts"); // changed: acr #1980's nested repository key pattern is in schemas ask-dev does not vendor. // c2914f0b -> 3a5bf05a: the same SHA as web (web #2034). No file ask-dev vendors changed: acr // #2117's throughputForecast `degradedReason` is in `contracts/mcp`, which ask-dev does not vendor. -export const SOURCE_COMMIT = "3a5bf05ae5bdc6815b2f8f53dade65641994827b"; +// 3a5bf05a -> ff4ae590: the same SHA as web (web main). +export const SOURCE_COMMIT = "ff4ae5908c73c740da7e57fce384ec1871f67493"; const PRETTIER_OPTIONS = Object.freeze({ parser: "typescript", diff --git a/src/contracts/generated/answer-projection.ts b/src/contracts/generated/answer-projection.ts index 9a49fd4..0edd83a 100644 --- a/src/contracts/generated/answer-projection.ts +++ b/src/contracts/generated/answer-projection.ts @@ -1,7 +1,7 @@ /* eslint-disable */ /** * GENERATED by scripts/sync-acr-contracts.mjs. DO NOT EDIT. - * Source: full-chaos/dev-health-acr @ 3a5bf05ae5bdc6815b2f8f53dade65641994827b + * Source: full-chaos/dev-health-acr @ ff4ae5908c73c740da7e57fce384ec1871f67493 * Regenerate with `pnpm acr:contracts:generate --source `. */ diff --git a/src/contracts/generated/error.ts b/src/contracts/generated/error.ts index 8d19b4c..666958a 100644 --- a/src/contracts/generated/error.ts +++ b/src/contracts/generated/error.ts @@ -1,7 +1,7 @@ /* eslint-disable */ /** * GENERATED by scripts/sync-acr-contracts.mjs. DO NOT EDIT. - * Source: full-chaos/dev-health-acr @ 3a5bf05ae5bdc6815b2f8f53dade65641994827b + * Source: full-chaos/dev-health-acr @ ff4ae5908c73c740da7e57fce384ec1871f67493 * Regenerate with `pnpm acr:contracts:generate --source `. */ @@ -10,7 +10,7 @@ export interface ACRErrorV1 { request_id: string; error: { /** - * stream_unavailable is the 406 of a create-investigation request that asks for the event stream (Accept: text/event-stream) while the deployment has the stream turned off. It is written before any admission work and is not retryable. submission_mismatch, submission_in_progress, submission_unsaved and submission_abandoned are the 409s of a create-investigation request whose X-ACR-Submission-ID was already admitted: a different request under that id; its run still live (retryable, with Retry-After); answered but not stored; ended without an answer. None of them runs the request again. submission_required is the 400 of a create-investigation request by a browser-class credential that names no single well-formed X-ACR-Submission-ID (missing, malformed or repeated): refused before admission and model work, nothing ran, and it is not retryable as sent. concurrency_limited and allowance_exhausted are the 429s of a create-investigation request that names a new X-ACR-Submission-ID over a shared Ask Dev limit: running runs per principal or per organization (details.limit principal or org), or the organization's monthly allowance of runs on the deployment's model. Both carry Retry-After; nothing was admitted. thread_closed is the 409 of a create-investigation request whose X-ACR-Thread-ID, or X-ACR-Submission-ID, belongs to a conversation of the caller that was deleted, has expired or is full (1000000 turns): nothing ran, and the request is not retryable under those ids; start a new conversation. canceled, run_lost and cursor_expired belong to the run lease (CHAOS-11949): canceled (409) is the terminal error of a run its owner canceled; run_lost (503) is the terminal error of a run whose service instance stopped and whose lease ended; neither is retryable under the submission id. cursor_expired (410) is the answer to an attach whose Last-Event-ID the event log cannot serve (malformed, never written, older than the kept window, or at or past the terminal): read the submission status and replay the result by id instead. access_denied, no_repository and budget_exhausted are the per-call access read's refusals of a call by a user-class credential (browser, OAuth user, native device), which re-reads the user's access live on every protected call: access_denied is the 403 when the user is not a member of the organization, is impersonating, the browser credential's session is not live, or the organization or user is unknown (one code for every reason, not retryable); no_repository is the 409 when the credential's repository grant within the organization's live repository inventory is empty (not retryable as sent); budget_exhausted is the 503 of a create-investigation request whose wait budget left after the access read is below the minimum, refused before admission with nothing run (retryable). + * stream_unavailable is the 406 of a create-investigation request that asks for the event stream (Accept: text/event-stream) while the deployment has the stream turned off, or asks for an accept-first create (Prefer: respond-async) while the deployment runs no leased runs (run lease or stream off). It is written before any admission work and is not retryable. submission_mismatch, submission_in_progress, submission_unsaved and submission_abandoned are the 409s of a create-investigation request whose X-ACR-Submission-ID was already admitted: a different request under that id; its run still live (retryable, with Retry-After); answered but not stored; ended without an answer. None of them runs the request again. submission_required is the 400 of a create-investigation request by a browser-class credential that names no single well-formed X-ACR-Submission-ID (missing, malformed or repeated): refused before admission and model work, nothing ran, and it is not retryable as sent. concurrency_limited and allowance_exhausted are the 429s of a create-investigation request that names a new X-ACR-Submission-ID over a shared Ask Dev limit: running runs per principal or per organization (details.limit principal or org), or the organization's monthly allowance of runs on the deployment's model. Both carry Retry-After; nothing was admitted. thread_closed is the 409 of a create-investigation request whose X-ACR-Thread-ID, or X-ACR-Submission-ID, belongs to a conversation of the caller that was deleted, has expired or is full (1000000 turns): nothing ran, and the request is not retryable under those ids; start a new conversation. canceled, run_lost and cursor_expired belong to the run lease (CHAOS-11949): canceled (409) is the terminal error of a run its owner canceled; run_lost (503) is the terminal error of a run whose service instance stopped and whose lease ended; neither is retryable under the submission id. cursor_expired (410) is the answer to an attach whose Last-Event-ID the event log cannot serve (malformed, never written, older than the kept window, or at or past the terminal): read the submission status and replay the result by id instead. access_denied, no_repository and budget_exhausted are the per-call access read's refusals of a call by a user-class credential (browser, OAuth user, native device), which re-reads the user's access live on every protected call: access_denied is the 403 when the user is not a member of the organization, is impersonating, the browser credential's session is not live, or the organization or user is unknown (one code for every reason, not retryable); no_repository is the 409 when the credential's repository grant within the organization's live repository inventory is empty (not retryable as sent); budget_exhausted is the 503 of a create-investigation request whose wait budget left after the access read is below the minimum, refused before admission with nothing run (retryable). */ code: | "invalid_request" diff --git a/src/contracts/generated/investigation-request.ts b/src/contracts/generated/investigation-request.ts index 9bd30c4..0b39710 100644 --- a/src/contracts/generated/investigation-request.ts +++ b/src/contracts/generated/investigation-request.ts @@ -1,7 +1,7 @@ /* eslint-disable */ /** * GENERATED by scripts/sync-acr-contracts.mjs. DO NOT EDIT. - * Source: full-chaos/dev-health-acr @ 3a5bf05ae5bdc6815b2f8f53dade65641994827b + * Source: full-chaos/dev-health-acr @ ff4ae5908c73c740da7e57fce384ec1871f67493 * Regenerate with `pnpm acr:contracts:generate --source `. */ diff --git a/src/contracts/generated/investigation-result.ts b/src/contracts/generated/investigation-result.ts index 2a14feb..6761b48 100644 --- a/src/contracts/generated/investigation-result.ts +++ b/src/contracts/generated/investigation-result.ts @@ -1,7 +1,7 @@ /* eslint-disable */ /** * GENERATED by scripts/sync-acr-contracts.mjs. DO NOT EDIT. - * Source: full-chaos/dev-health-acr @ 3a5bf05ae5bdc6815b2f8f53dade65641994827b + * Source: full-chaos/dev-health-acr @ ff4ae5908c73c740da7e57fce384ec1871f67493 * Regenerate with `pnpm acr:contracts:generate --source `. */ diff --git a/src/contracts/manifest.json b/src/contracts/manifest.json index 7e4a9df..74d68ce 100644 --- a/src/contracts/manifest.json +++ b/src/contracts/manifest.json @@ -1,5 +1,5 @@ { - "source_commit": "3a5bf05ae5bdc6815b2f8f53dade65641994827b", + "source_commit": "ff4ae5908c73c740da7e57fce384ec1871f67493", "source_repository": "full-chaos/dev-health-acr", "files": [ { @@ -80,11 +80,11 @@ }, { "path": "schemas/context_fabric_submission_status.v1.schema.json", - "sha256": "983475167bf88e97fac2cb9df331427a264d5fc8b91a370c0f157178b793787a" + "sha256": "1d6b651adcf992cd1f9bb1dc165ea30e5eb762f59efffd3805599135a70adb76" }, { "path": "schemas/error.v1.schema.json", - "sha256": "ba24b482af78d234ea2d722340d2a472f950d6f2256c436980c45a3d0baa9ff5" + "sha256": "84b29765e50b779d1a4255d10f39312958a78b21a3c47ea96b87b8353fd5d613" } ] } diff --git a/src/contracts/schemas/context_fabric_submission_status.v1.schema.json b/src/contracts/schemas/context_fabric_submission_status.v1.schema.json index 805ea8c..02452e8 100644 --- a/src/contracts/schemas/context_fabric_submission_status.v1.schema.json +++ b/src/contracts/schemas/context_fabric_submission_status.v1.schema.json @@ -11,7 +11,7 @@ "submission_id": { "type": "string", "minLength": 8, "maxLength": 128, "pattern": "^[A-Za-z0-9._:-]{8,128}$" }, "state": { "enum": ["running", "done", "done_unsaved", "abandoned"], - "description": "running: the run is live. done: result_id names the final result. done_unsaved: the answer was served but not stored, so there is nothing to replay. abandoned: the run ended without an answer, or ran past its budget plus 30 seconds. No state runs the request again." + "description": "running: the run is live. done: result_id names the final result. done_unsaved: the answer was served but not stored, so there is nothing to replay; for an accept-first create (Prefer: respond-async) the answer reached no one, so ask again. abandoned: the run ended without an answer, or ran past its budget plus 30 seconds. No state runs the request again." }, "reserved_result_id": { "type": "string", "minLength": 8, "maxLength": 256 }, "result_id": { @@ -27,9 +27,42 @@ "pattern": "^[A-Za-z0-9._:-]{8,128}$", "description": "The X-ACR-Thread-ID the submission was admitted with, when it named one." }, - "updated_at": { "type": "string", "format": "date-time" } + "updated_at": { "type": "string", "format": "date-time" }, + "last_stage": { + "enum": ["interpreting", "resolving_subjects", "reading_facts", "synthesizing", "validating"], + "description": "The last stage the run started, read from its event log. Present only on a deployment with the run lease on, for a submission admitted under the lease, once a stage started." + }, + "terminal": { + "type": "object", + "additionalProperties": false, + "required": ["kind"], + "description": "How a run admitted under the run lease ended, read from its event log. Absent while state is running, for a submission with no lease, on a deployment with the run lease off, and on a final record whose log does not hold its end yet (the delivery can still end in an error after the record is final; read again). A read of a running record whose lease ended takes the run over first, so it answers abandoned with error_code run_lost; a read of a final record whose lease ended with no end in its log appends the end its state implies (run_lost for abandoned), once.", + "properties": { + "kind": { + "enum": ["result", "unsaved", "error"], + "description": "result: the run ended with a stored result (result_id). unsaved: the answer was served but not stored. error: the run ended with an error.v1 envelope; error_code is its error.code." + }, + "error_code": { + "type": "string", + "minLength": 1, + "maxLength": 64, + "description": "Present exactly when kind is error: an error.v1 error.code value; canceled when the owner canceled the run, run_lost when the replica running it stopped." + } + }, + "if": { "properties": { "kind": { "const": "error" } } }, + "then": { "required": ["error_code"] }, + "else": { "not": { "required": ["error_code"] } } + } }, - "if": { "properties": { "state": { "const": "done" } } }, - "then": { "required": ["result_id"] }, - "else": { "not": { "required": ["result_id"] } } + "allOf": [ + { + "if": { "properties": { "state": { "const": "done" } } }, + "then": { "required": ["result_id"] }, + "else": { "not": { "required": ["result_id"] } } + }, + { + "if": { "properties": { "state": { "const": "running" } } }, + "then": { "not": { "required": ["terminal"] } } + } + ] } diff --git a/src/contracts/schemas/error.v1.schema.json b/src/contracts/schemas/error.v1.schema.json index d83c83e..f4b2cce 100644 --- a/src/contracts/schemas/error.v1.schema.json +++ b/src/contracts/schemas/error.v1.schema.json @@ -61,7 +61,7 @@ "no_repository", "budget_exhausted" ], - "description": "stream_unavailable is the 406 of a create-investigation request that asks for the event stream (Accept: text/event-stream) while the deployment has the stream turned off. It is written before any admission work and is not retryable. submission_mismatch, submission_in_progress, submission_unsaved and submission_abandoned are the 409s of a create-investigation request whose X-ACR-Submission-ID was already admitted: a different request under that id; its run still live (retryable, with Retry-After); answered but not stored; ended without an answer. None of them runs the request again. submission_required is the 400 of a create-investigation request by a browser-class credential that names no single well-formed X-ACR-Submission-ID (missing, malformed or repeated): refused before admission and model work, nothing ran, and it is not retryable as sent. concurrency_limited and allowance_exhausted are the 429s of a create-investigation request that names a new X-ACR-Submission-ID over a shared Ask Dev limit: running runs per principal or per organization (details.limit principal or org), or the organization's monthly allowance of runs on the deployment's model. Both carry Retry-After; nothing was admitted. thread_closed is the 409 of a create-investigation request whose X-ACR-Thread-ID, or X-ACR-Submission-ID, belongs to a conversation of the caller that was deleted, has expired or is full (1000000 turns): nothing ran, and the request is not retryable under those ids; start a new conversation. canceled, run_lost and cursor_expired belong to the run lease (CHAOS-11949): canceled (409) is the terminal error of a run its owner canceled; run_lost (503) is the terminal error of a run whose service instance stopped and whose lease ended; neither is retryable under the submission id. cursor_expired (410) is the answer to an attach whose Last-Event-ID the event log cannot serve (malformed, never written, older than the kept window, or at or past the terminal): read the submission status and replay the result by id instead. access_denied, no_repository and budget_exhausted are the per-call access read's refusals of a call by a user-class credential (browser, OAuth user, native device), which re-reads the user's access live on every protected call: access_denied is the 403 when the user is not a member of the organization, is impersonating, the browser credential's session is not live, or the organization or user is unknown (one code for every reason, not retryable); no_repository is the 409 when the credential's repository grant within the organization's live repository inventory is empty (not retryable as sent); budget_exhausted is the 503 of a create-investigation request whose wait budget left after the access read is below the minimum, refused before admission with nothing run (retryable)." + "description": "stream_unavailable is the 406 of a create-investigation request that asks for the event stream (Accept: text/event-stream) while the deployment has the stream turned off, or asks for an accept-first create (Prefer: respond-async) while the deployment runs no leased runs (run lease or stream off). It is written before any admission work and is not retryable. submission_mismatch, submission_in_progress, submission_unsaved and submission_abandoned are the 409s of a create-investigation request whose X-ACR-Submission-ID was already admitted: a different request under that id; its run still live (retryable, with Retry-After); answered but not stored; ended without an answer. None of them runs the request again. submission_required is the 400 of a create-investigation request by a browser-class credential that names no single well-formed X-ACR-Submission-ID (missing, malformed or repeated): refused before admission and model work, nothing ran, and it is not retryable as sent. concurrency_limited and allowance_exhausted are the 429s of a create-investigation request that names a new X-ACR-Submission-ID over a shared Ask Dev limit: running runs per principal or per organization (details.limit principal or org), or the organization's monthly allowance of runs on the deployment's model. Both carry Retry-After; nothing was admitted. thread_closed is the 409 of a create-investigation request whose X-ACR-Thread-ID, or X-ACR-Submission-ID, belongs to a conversation of the caller that was deleted, has expired or is full (1000000 turns): nothing ran, and the request is not retryable under those ids; start a new conversation. canceled, run_lost and cursor_expired belong to the run lease (CHAOS-11949): canceled (409) is the terminal error of a run its owner canceled; run_lost (503) is the terminal error of a run whose service instance stopped and whose lease ended; neither is retryable under the submission id. cursor_expired (410) is the answer to an attach whose Last-Event-ID the event log cannot serve (malformed, never written, older than the kept window, or at or past the terminal): read the submission status and replay the result by id instead. access_denied, no_repository and budget_exhausted are the per-call access read's refusals of a call by a user-class credential (browser, OAuth user, native device), which re-reads the user's access live on every protected call: access_denied is the 403 when the user is not a member of the organization, is impersonating, the browser credential's session is not live, or the organization or user is unknown (one code for every reason, not retryable); no_repository is the 409 when the credential's repository grant within the organization's live repository inventory is empty (not retryable as sent); budget_exhausted is the 503 of a create-investigation request whose wait budget left after the access read is below the minimum, refused before admission with nothing run (retryable)." }, "message": { "type": "string",