---
title: "Reconcile invalid chat state"
method: POST
path: "/api/experimental/chats/{chat}/reconcile-invalid"
tags: ["Chats"]
---

# Reconcile invalid chat state

`POST /api/experimental/chats/{chat}/reconcile-invalid`

Experimental: this endpoint is subject to change.

## Path parameters

- `chat` string, uuid, required

## Response `200`

OK

- CodersdkChat
  - `agent_id` string, uuid
  - `archived` boolean
  - `build_id` string, uuid
  - `children` CodersdkChat[] — Children holds child (subagent) chats nested under this root chat. Always initialized to an empty slice so the JSON field is present as []. Child chats cannot create their own subagents, so nesting depth is capped at 1 and this slice is always empty for child chats.
  - `client_type` 'ui' | 'api'
  - `context` CodersdkChatContext
    - `dirty` boolean — Dirty is true when the agent's latest snapshot hash differs from the chat's pinned hash.
    - `dirty_since` string, date-time — DirtySince is when drift was first detected; nil when not dirty.
    - `error` string — Error is the snapshot-level error copied from the pinned snapshot (empty when healthy).
    - `resources` CodersdkChatContextResource[] — Resources is the chat's pinned context (instruction files and skills) the prompt is built from, metadata only (no bodies). It is populated only on the single-chat GET response; list and watch payloads leave it nil to stay lightweight.
      - `error` string — Error explains a non-ok Status; empty when healthy. May also carry a non-fatal warning when Status is ok.
      - `kind` 'instruction_file' | 'skill' | 'mcp_config' | 'mcp_server'
      - `size_bytes` integer — SizeBytes is the original payload size in bytes.
      - `skill_description` string
      - `skill_name` string — SkillName and SkillDescription are populated only for skill kinds.
      - `source` string — Source is the resource locator: the canonical file path for an instruction file, the skill directory for a skill, the file path for an MCP config, or the server name for an MCP server.
      - `status` 'ok' | 'oversize' | 'unreadable' | 'invalid' | 'excluded'
      - `tools` CodersdkChatContextTool[] — Tools lists the tools exposed by an MCP server. Populated only for the mcp_server kind; nil otherwise.
        - `description` string — Description is the tool's human-readable summary; may be empty.
        - `name` string — Name is the tool name with the `<server>__` prefix the agent adds stripped, so it reads as the server exposes it.
  - `created_at` string, date-time
  - `diff_status` CodersdkChatDiffStatus
    - `additions` integer
    - `approved` boolean
    - `author_avatar_url` string
    - `author_login` string
    - `base_branch` string
    - `changed_files` integer
    - `changes_requested` boolean
    - `chat_id` string, uuid
    - `commits` integer
    - `deletions` integer
    - `head_branch` string
    - `pr_number` integer
    - `pull_request_draft` boolean
    - `pull_request_state` string
    - `pull_request_title` string
    - `refreshed_at` string, date-time
    - `reviewer_count` integer
    - `stale_at` string, date-time
    - `url` string
  - `files` CodersdkChatFileMetadata[]
    - `created_at` string, date-time
    - `id` string, uuid
    - `mime_type` string
    - `name` string
    - `organization_id` string, uuid
    - `owner_id` string, uuid
  - `has_unread` boolean — HasUnread is true when assistant messages exist beyond the owner's read cursor, which updates on stream connect and disconnect.
  - `id` string, uuid
  - `labels` object
  - `last_error` CodersdkChatError
    - `detail` string — Detail is optional provider-specific context shown alongside the normalized error message when available.
    - `kind` 'generic' | 'overloaded' | 'rate_limit' | 'timeout' | 'stream_silence_timeout' | 'auth' | 'config' | 'usage_limit' | 'missing_key' | 'provider_disabled' | 'content_filter' | 'hook_dispatch_failed' | 'hook_denied'
    - `message` string — Message is the normalized, user-facing error message.
    - `provider` string — Provider identifies the upstream model provider when known.
    - `retryable` boolean — Retryable reports whether the underlying error is transient.
    - `status_code` integer — StatusCode is the best-effort upstream HTTP status code.
  - `last_model_config_id` string, uuid
  - `last_reasoning_effort` string
  - `last_turn_summary` string
  - `mcp_server_ids` string[]
  - `organization_id` string, uuid
  - `owner_id` string, uuid
  - `owner_name` string
  - `owner_username` string
  - `parent_chat_id` string, uuid
  - `pin_order` integer
  - `plan_mode` 'plan'
  - `root_chat_id` string, uuid
  - `shared` boolean — Shared is true when this chat's root chat has explicit user or group ACL entries.
  - `status` 'waiting' | 'running' | 'error' | 'requires_action' | 'interrupting'
  - `summary` string — Summary is the persisted whole-chat summary, generated in the background. It is nil until the first summary has been produced.
  - `title` string
  - `updated_at` string, date-time
  - `warnings` string[]
  - `workspace_id` string, uuid

---

[API](https://skmtc.net/coder/apis/coder-api.md) · [All operations](https://skmtc.net/coder/apis/coder-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/coder/coder-api/versions/56b6e9f08540/schema)
