Table of Contents

Chat generation

Text in, generated text out. This page describes the second kind of outbound AI call MailFathom makes: what a deployment declares to enable it, what one call is allowed to spend, what a failing call is classified as, and how an operator sees whether the provider is working.

It is the transport and nothing above it. Nothing here composes a prompt, retrieves anything, offers the model tools, or keeps a conversation — what to say is decided by whoever calls, and this is what says it. What calls it is the answering run behind the ask_mail tool, described in Mail answering, and the optional second retrieval pass beside it.

A chat provider and an embedding provider are separate choices

Chat is a configuration root of its own beside Embeddings, and the two are declared, credentialed, called, and reported on independently. That is deliberate, because the states they produce are different:

  • No embedding provider. Semantic search is off and lexical search continues. Embedding generation describes that half.
  • No chat provider. Search is unaffected, and only the answering capability stops being offered. Mail answering describes what that capability is composed of.

An instance may reasonably have one and not the other, so a single "AI is configured" flag would be wrong in both directions. Writing neither section is a supported deployment: nothing is generated, no provider is called, no credential is needed, and every read path serves as it always did.

A section carrying a capability's settings and no model at all is the one shape startup refuses rather than passes over. It reads to an operator as a configured provider while nothing would ever call it.

One declared model serves more than one capability. Beside answering a question, it is what judges retrieved candidates for relevance where a deployment turns that pass on — a block inside this section, off by default, described in Mail answering § An optional second pass. It is also what reads a sentence somebody typed into a search field into filters they can see and correct, which Email search § A typed sentence becomes filters describes and AI configuration § Chat:SearchPhrasing turns off. It is also what reads an opened contact's correspondence into the note that heads it, which Where a correspondence with one person stands describes. Each capability is a separate decision over the models declared here, and every call any of them makes carries the parameters, the deadline, and the budget the model it runs on declares.

Declared models, and the references into them

Chat:Models is an array. Each block is one model — its address, its credential, its parameters, its bounds — under an alias of its own, and a capability names that alias rather than restating any of it. Two capabilities routed to one model therefore share one declaration instead of two copies of it that can drift, and a deployment that wants the pass a reader waits in front of on a small fast model writes a second block rather than an override.

Every capability may name a model of its own, through a Model block shaped exactly alike wherever it appears: Chat:MailAnswering, Chat:Agent, Chat:DiscoveryPlanning, Chat:DiscoveryComposition, Chat:Enrichment, Chat:ThreadState, Chat:ReplyDrafting, Chat:ContactRelationship, Chat:SearchPhrasing, Chat:RelevanceFilter, Chat:ImageDescription, Chat:BodyCleanup, Chat:CalendarEventExtraction, Chat:DayLayout, and Chat:ConversationCompaction. That is what lets one deployment run the per-message derivations and the per-candidate judgement on a cheap fast model while answering and drafting keep the best one it pays for, and describe a picture with a vision model while everything else runs on a cheaper text-only one. A capability that names none runs on Chat:MainModel, which is what every deployment did before these keys existed.

A deployment with one model writes one block and nothing else. Chat:MainModel may be left unwritten where exactly one is declared, because there is nothing for it to choose between; where several are, it has to be written, since a section declaring two models and saying nothing has not stated which one answers.

A reference may name a fallback, and that is the whole of the chain

The embedding declaration is an ordered chain because a fallback embedding endpoint is another route to one vector space: startup proves every endpoint of the chain declares the same geometry, so falling through cannot change what a vector means. Nothing proves that of two chat models, and this is the release that decided the trade differently anyway: a question answered by a second model in a second voice is better than a question not answered at all, and what makes it honest is that the run says which model answered.

So a reference may carry a Fallback naming a second declared alias — never the model declaration itself, which is what bounds the chain and makes a cycle unwritable. A model named as its own fallback is refused.

A capability routed to a model of its own has three links, and every one of them is named by the operator: the model the capability names, the Fallback beside it, and Chat:MainModel behind both. That last step is what keeps a cheap endpoint failing from turning a capability off — the work degrades to the model the deployment answers questions with rather than stopping — and it is also where the chain ends: the main model's own Fallback is not attempted after it, so one call reaches at most three models. A capability that names no model of its own takes the main model and the main model's fallback, which is two links and is what every deployment writing none of these keys has.

A model already in the chain is attempted once rather than twice, so a capability routed to the main model, or naming it as its own fallback, stops there.

Two failures are never worth a second model. A request the provider refused is refused the same way by a second endpoint, for a second payment; an answer that came back empty is a call that succeeded and a model that had nothing to say. Everything else — a credential the endpoint rejected, a rate limit, a timeout, a faulted transport — is a statement about that endpoint, and the fallback is a different address under a different credential, which is what makes asking it worth the money. What is retried is opening a client and asking, rather than re-sending a message down a connection that failed.

A credential that could not be resolved at all is in that second group, and deliberately: an alias naming no declared model, or a secret reference nothing provisions, is a model this deployment cannot use until somebody corrects it, which is the clearest case there is for asking the one behind it. The fall-through warning names it like any other, and the log line about the endpoint says a credential rather than a provider is what an operator has to fix.

A fallback is asked against its own bounds, not the main model's. MaxMessagesPerRequest, MaxRequestCharacters, and MaxRequestImageOctets belong to the block that declares them, so a conversation the main model admits may be wider than the fallback behind it accepts. That call is refused before it is sent rather than sent and paid for, and it is refused as the fallback's own failure — the same classification a provider rejecting the request would have produced, which is one the chain does not fall through on. Declare a fallback at least as wide as the model in front of it where the point is for it to answer everything that model would have.

One question is one run however many models it was asked of. The run's allowance — the provider calls and the tokens Ask bounds a single question by — is spent across the whole chain rather than reopened behind each model, so a fallback attempt continues the run instead of starting a second one. A deployment whose allowance is already spent when the main model fails gets no fallback attempt, which is the ceiling working rather than the fallback failing.

The answering run is attributed to the model that answered it. A question the fallback served names the fallback in the run's own record, by alias and by that block's own PublishedModel, because a cost record naming a model the deployment never called is worse than no record at all.

Every capability's outcome line names the model that answered it, not the alias the capability was configured with. A fallback producing a cleaning proposal, an enrichment mark, a reply draft, a search reading, a thread state, a Discover plan or a Discover composition is named as the fallback in the line that reports it, and a chat call that failed is reported against the endpoint that failed rather than the one asked first.

A Discover run's opening event is the one place that still names the model the run began against. It is sent before anything has been composed — which is the point of it, a person waiting for an answer being told which model is about to produce one — so it cannot know that the model would fail and the fallback would answer. What shows that is the warning written on the fall-through, and the run's own record.

A model's name is what everything else calls it

Alias is the deployment's own name for a model. Everything else in a block is an address or a credential, and neither may be written down — an address identifies a tenant and a resource — so the alias is what a log line, a metric tag, a resilience circuit, and a failure message carry instead.

An alias names one endpoint across the whole deployment. A chat model reusing another chat model's alias, or an embedding endpoint's, is refused at startup and again on every reloaded declaration, because the alias is what a credential is resolved by, what a resilience circuit is keyed by, and what every log line naming an endpoint carries. Two endpoints answering to one name would share all three, so a chat outage would open the circuit the embeddings were being served through.

An endpoint is any service that speaks the OpenAI wire protocol

Each declared model is reached through the same client construction the embedding adapter uses, and nothing in a declaration is a compile-time constant: the model, the address, the API, the output budget, and the sampling parameters are all read from configuration. Pointing this deployment at a different service is therefore a configuration entry rather than a feature request.

OpenAI and Azure OpenAI are what this project declares, which is a different statement from what the mechanism reaches. Azure is already the second case rather than a special one: an Azure resource's v1 data plane is OpenAI-compatible, so a cloud deployment is that same client pointed at the resource's own /openai/v1/ address with the deployment's name as the routed model. A third-party service speaking the same protocol is declared by the same values and reaches the same code — and "compatible" is that service's claim about itself rather than something checked here, which embedding generation § Compatible is not verified states in full for both roles. Provider endpoints is where a service somebody checked is recorded, including which of the two request APIs below it was found to serve.

There is no vendor and no model identity in the declaration beside the routed name, and that is the difference from an embedding endpoint rather than an omission. A vector is stored and later compared against other vectors, so which model produced it has to be recorded and proved; an answer is produced, presented, and gone.

The address and credential rules are the same ones, for the same reasons, and one implementation judges both roles. An address is absolute HTTP or HTTPS; a plain http one is refused wherever the endpoint holds a credential, because the request would publish it to everything on the path; and exactly one of a provider key, a Microsoft Entra credential, and Unauthenticated says what a request presents. An empty address means the provider library's own default, which is the first-party OpenAI API, so any other service writes its own address out. What an address has to be and authentication has three shapes carry both rules with their reasoning.

A chat model you run yourself is declared here the same way an embedding model is — the plain address plus "Unauthenticated": true — and what such a deployment gains and gives up is set out under a model server you run yourself. One thing is worth repeating on this page, because this role is where it bites hardest: the hop carries the question asked, the mail passages the model is given to answer it, and the answer it returns, all readable by anything on the network path. The startup report names the endpoint so that fact is visible rather than inferred.

A worked example: an endpoint that is neither

The names are placeholders, and nothing in the declaration is matched against a list of vendors, models, or hosts:

{
  "Chat": {
    "Models": [
      {
        "Alias": "house-chat",
        "Model": "example-chat-2",
        "Api": "ChatCompletions",
        "Address": "https://chat.example.test/v1",
        "MaxOutputTokens": 2048,
        "ApiKey": {
          "Name": "house-chat-key",
          "SecretReference": "file:/etc/mailfathom/secrets/house-chat-key"
        }
      }
    ]
  }
}

Read across it: Alias is what every log line, metric tag, and circuit calls this model, and it may not repeat an alias another model or an embedding endpoint declared, because one credential source resolves both sections; Model is what the request routes on, written as the service knows it rather than as a vendor's catalogue spells it; Address carries the whole base path the service documents for its OpenAI-compatible surface, including any version segment; Api says which path under that address a request goes to, and it is the setting most likely to need changing for a service that serves only one of the two; and MaxOutputTokens bounds what a single answer may cost, which no provider default does. Nothing names Chat:MainModel, because one model is declared and there is nothing to choose between.

A worked example: a second model behind the first

The second block is an ordinary declaration — its own address, its own credential, its own bounds — and what makes it a fallback is the reference rather than anything in the block:

{
  "Chat": {
    "Models": [
      {
        "Alias": "house-chat",
        "Model": "example-chat-2",
        "Address": "https://chat.example.test/v1",
        "ApiKey": { "SecretReference": "file:/etc/mailfathom/secrets/house-chat-key" },
        "ExtraHeaders": [
          {
            "Name": "X-Tenant",
            "Value": { "SecretReference": "file:/etc/mailfathom/secrets/house-chat-tenant" }
          }
        ]
      },
      {
        "Alias": "standby-chat",
        "Model": "example-chat-1",
        "Address": "https://standby.example.test/v1",
        "ApiKey": { "SecretReference": "file:/etc/mailfathom/secrets/standby-chat-key" }
      }
    ],
    "MainModel": {
      "Alias": "house-chat",
      "Fallback": "standby-chat"
    }
  }
}

A question the first model could not answer — a rejected credential, a rate limit, a timeout, a faulted transport — is asked of the second, and the run reports that the second answered it. A question the first model refused, or answered with nothing, ends there.

Whether such an endpoint can serve ask_mail at all is a separate question from whether it answers: the run offers the model function tools and the model calls them when it decides it needs mail, so a service or model that cannot be given function tools cannot answer here. That is discovered from a request refused on the first question rather than at startup.

Two APIs, and the deployment says which

Api names which of the provider's two request APIs a call is conducted through: ChatCompletions, which is what a deployment stating nothing runs on, or Responses. Both are reached over one endpoint with one credential on one transport under one resilience budget, so what differs is the path a request goes to — /chat/completions or /responses under the declared address — and what the provider will accept there.

It is declared rather than derived, and that is the decision rather than a shortcut. Deriving it would mean reading the routed model name, and that name is not a model identity: for a cloud deployment it is whatever the operator called the deployment, so a derivation would be guessing from a string the operator invented, and a wrong guess is one nothing in the deployment could correct. Declaring it costs an operator one line about their own provider, which is a thing they already know; deriving it would cost every operator whose provider does not match the guess a capability they cannot turn back on. Azure's OpenAI-compatible surface and any self-hosted OpenAI-compatible server are exactly why: neither necessarily offers both paths, and nothing about a model name says which.

When it has to be Responses. A current reasoning model refuses function tools beside a stated reasoning effort on the chat completions API, and names the responses API as the way to have both. The answering run behind ask_mail is a tool loop by construction — the model asks for mail, retrieval answers, the model writes — so removing the tools would remove the capability rather than work around the refusal. A deployment that wants such a model states Responses here. Choosing it against a server that does not serve that path is a request refused: the endpoint rejected the request itself, so it is not repeated and the provider is reported misconfigured until the declaration is corrected.

One consequence is worth knowing. The responses API reports an outcome rather than a finish reason, so an answer that simply finished names nothing and arrives as Unreported in the table below rather than as Completed. A truncation and a content filter still arrive named, which is what keeps either from being repeated as though it were a transport fault. Nothing else about the two paths is visible above this boundary.

The responses API is used statelessly, and that is not an option

A request over the responses API carries the question, the run's instruction, and the mail passages retrieval selected for it, and that API keeps what it is sent unless the request refuses — for thirty days, readable in the provider's own console by anyone holding the account. So every call MailFathom conducts over it states store: false. The chat completions API keeps nothing unless a request asks it to, so a call over that path carries no such member at all — which is what makes the choice of Api a choice about capability rather than about what the provider retains.

It is not a setting, and there is no key that turns it back on. A deployment whose correspondence is copied into a third party's log is not a shape this project offers, so the refusal is a property of the path rather than a default an operator may reconsider. What an operator does decide is whether to declare a hosted provider at all, and what leaves the instance when a question is asked is the page that states what such a call carries.

Storing nothing means the run carries its own reasoning. A reasoning model returns what it worked out as encrypted content it cannot read back later unless the caller hands it over on the next turn, and the provider emits that content only where the request asked for it — so every call also asks for reasoning.encrypted_content. The answering run is a tool loop, and without it each turn after the first would begin without what the model had already worked out about the mail it read, which the model then pays to work out again. A model that does not reason returns none, and the request is otherwise unchanged.

Authentication has three shapes

The same three, under the same rules and through the same implementation of them as an embedding endpoint's: exactly one of a provider key, one of four non-interactive Microsoft Entra credentials, and Unauthenticated. Embedding generation § Authentication has three shapes states them in full, including why DefaultAzureCredential is deliberately not used, what rotating each shape costs, and why needing no credential is written rather than left out. One credential source resolves both sections, keyed by the alias, which is what the deployment-wide uniqueness rule above exists to make safe.

A model may declare headers of its own

ExtraHeaders is a list of name and value pairs a model sends on every request beside whatever the credential writes. It is the shape a gateway fronting several models asks for: a tenant, a project, or a routing key that decides which model answers. It is declared per model rather than once for the section, because the gateway one model is reached through is not the server another one is, and it is empty for the ordinary deployment that reaches its model directly.

The value is a secret reference rather than a string. What goes in one of these is a routing token or a tenant identifier — material of the same kind as the key beside it — so it is resolved per request, kept out of the configuration file, and found by the same secret discovery that finds every other credential this deployment holds. A reference nothing provisions takes the model out of service rather than sending the request without the header, because a gateway reading that header would route the call somewhere else.

A model declaring none sends none, and nothing describing the platform either: Embedding generation § What a request says about the deployment that sent it holds what the client library would add on its own and why every request, to a chat model as to an embedding endpoint, goes out without it.

What a header may be called is bounded. It has to be a field name as RFC 9110 defines one, and it may not be one the request writes for itself: Authorization is the credential's own, and Host, Content-Length, Content-Type, and Transfer-Encoding frame the message. One name declared twice is refused as well, because a field name is sent once and the repetitions would be resolved, paid for, and discarded. All three rules are checked at startup, because the header collections validate on the way in and report a bad name as an exception at the point of use — which for a configured value means a start that succeeded and a provider call that threw.

The same declaration, with the same rules, is what an embedding endpoint carries, as embedding generation § An endpoint may declare headers of its own describes. One reading of what a header may be governs both.

A model may declare request members of its own

AdditionalProperties is a JSON object whose members a model sends on every request, beside the ones this deployment writes. It is how a parameter this build has no key for reaches the model — top_k, min_p, repetition_penalty, a seed, or a gateway's own routing block — without waiting for a release that names it, and it is declared per model because the parameters one model documents are not the ones another accepts. Each member goes out as a top-level member of the request body under the name it was declared with, on both APIs:

{
  "Chat": {
    "Models": [
      {
        "Alias": "gateway-chat",
        "Model": "example/chat-2",
        "Address": "https://gateway.example.test/api/v1/",
        "ApiKey": { "SecretReference": "file:/etc/mailfathom/secrets/gateway-chat-key" },
        "Temperature": 0.6,
        "AdditionalProperties": {
          "top_k": 20,
          "min_p": 0,
          "stop": ["<|im_end|>"],
          "provider": {
            "order": ["anthropic", "openai"],
            "allow_fallbacks": false,
            "max_price": { "prompt": 1 }
          }
        }
      }
    ]
  }
}

A member may be a whole document rather than a value, which is the shape a gateway asks for: OpenRouter takes its provider routing, its transforms, and its price ceiling in the request body and in no header, and nests one inside another. Write it as ordinary JSON, as provider is above, and the structure reaches the request unchanged.

A value keeps its JSON type as far as configuration allows. Configuration carries a document as a tree of text leaves, so both the structure and the type of each value are read back from it. A number, true, false, or null goes out as that literal, and anything else as a string. A value written as its JSON text is read as the JSON that text states, which is how a whole member is declared in one environment variable and the only way to send a string that would otherwise read as something else: "seed": "40" goes out as the number 40, while "route": "\"40\"" goes out as the string "40".

Two things a configuration tree cannot state, which are decided rather than guessed. Nothing in it says whether a node is an object or an array, because an array's member names are its indices — so a node whose child names are exactly the integers below their own count goes out as an array in index order, and any other node as an object. An object whose own members happen to be called 0 and 1 therefore goes out as a two-element array, and nothing could tell the two apart. And an object or an array with nothing inside it carries neither a value nor a child, which is what a null carries too, so it goes out as null. A deployment provisioned through environment variables writes the same tree under __ — Chat__Models__0__AdditionalProperties__provider__order__0 — and reaches the same request member.

What a member may be called is bounded. It is a top-level member name — letters, digits, and underscores, not starting with a digit — because the name becomes a path into the request body, and a dot or a bracket would address a member somewhere else; whatever the member holds is nested underneath it rather than written into its name. It may not be a member this deployment writes itself or already has a key for: the routed model, the turns, the instruction, the tools and the answer format, streaming, storage and what the responses API is asked to include, the number of answers, the output budget, the sampling parameters, and the reasoning effort. Each of those is a bound this deployment enforces, a privacy decision it states on every call — the responses API is told not to store the request whatever else is declared — or a parameter with a key of its own, which is MaxOutputTokens, Temperature, TopP, ReasoningEffort, or — for OpenRouter's session_id — StickySessions. The refusal is on the top-level name alone, so a nested member called store or temperature inside a gateway's own block is an ordinary value and goes out as one. One model carries at most 32 members, each at most 4096 characters of JSON and nested at most 16 levels deep. All of it is checked at startup.

A value is not a secret. It is written into the configuration file and into every request body, so a credential or a routing token belongs in a header, whose value is a secret reference.

A conversation can stay on one provider

OpenRouter answers one routed model from several upstream providers and chooses one per request, and a prompt cache belongs to the provider that filled it. An Agent conversation resends its whole history on every turn, so it is the request that gains most from reaching the same provider twice and loses most from reaching a new one. StickySessions asks OpenRouter to keep it where it is:

{
  "Alias": "agent",
  "Model": "example/chat-2",
  "Address": "https://openrouter.ai/api/v1/",
  "ApiKey": { "SecretReference": "file:/etc/mailfathom/secrets/openrouter-key" },
  "StickySessions": true
}

Only OpenRouter honours it today. A model declaring it sends a session only when its address is an openrouter.ai host. On any other address nothing is sent — no other provider reached through these APIs defines a session — and startup logs one warning naming the model's alias, so a configuration moving between providers keeps working and says where the setting has stopped doing anything.

What is grouped is one Agent conversation, and nothing else. Every request the conversation makes carries the same session: each turn, each round of a turn's tool loop, and the turns after a compaction rewrote the history. A fallback model sends it only if its own declaration asks for it, and OpenRouter keeps a session per model anyway. Without it OpenRouter routes by a hash of a request's first system message and first non-system message, and both of those move within one conversation — the first turn's question is sent with the moment and the accounts it was asked against and every later turn replays it as written, and a compaction replaces the opening turns with a summary — so each move would send the whole prefix to a provider whose cache has never seen it. Two conversations never share a session, whoever holds them, and the compaction summary is written by a run of its own that carries none.

Every other operation sends none. Each of them is one run whose calls share their opening messages, which is exactly what OpenRouter's default routing already keeps together, and a key wider than one run would pin unrelated mail's calls to one provider for no cache it could reuse.

The session is not the conversation's identifier. It is a SHA-256 hash of it, sent as the x-session-id header on both APIs, so OpenRouter receives a key to route by rather than a name this deployment uses in its own routes and records. A header rather than the body's session_id, because it reaches both APIs by the route every declared header takes; session_id is refused as an additional request member so nothing in the body can override it, and a declared header of the same name is overwritten by it.

The model and its parameters come from configuration

None of them is a compile-time constant, so changing model is an edit rather than a rebuild and a model released after this version can be declared without one. Nor is any of them read once: the declaration in force is read again for every question, which the section below states in full.

  • Model is what a request is routed to. For a cloud deployment that is the name the operator gave the deployment rather than the vendor's model identifier, because that is the string the endpoint recognizes.

  • PublishedModel is what a client is told answered, and it is a separate setting rather than a reading of Model for exactly the reason above: a routed name is a deployment's own, may carry a tenant or an internal routing label, and is nobody's business outside the deployment. An operator that writes one publishes it on a Discover run's opening event; one that writes nothing publishes nothing, and the endpoint alias — which names nothing outside this deployment — goes out either way.

  • MaxOutputTokens bounds what one answer may occupy. It is the one generation parameter with no useful provider default: left unset, a model is free to generate until it stops and a deployment cannot bound what a single call costs.

  • Temperature and TopP are left unset unless written. Several current models reject the parameters outright, so sending a value one of them refuses would turn every call the deployment makes into a rejected request — which is why writing nothing has to mean sending nothing.

  • ReasoningEffort states how much reasoning a model is asked to spend before it answers, and follows the same rule for the same reason: a model that does not reason rejects the parameter, so a section that writes none sends none and the request is exactly what it was. none is not the same as writing nothing — it states an effort of none and sends it, which is precisely what a provider refusing function tools beside an unstated effort asks for. Not every reasoning model accepts every level, and one that does not refuses the request rather than falling back.

    The level is the provider's word, carried through as written. Write what the model's own documentation calls it — none, minimal, low, medium, high, xhigh — and a level a model gains after this release works without one, which is the whole reason it is not a set fixed here. xhigh is the worked example: it arrived after the levels beneath it, and a deployment on a build that predates it would otherwise have had to wait for a release to use it. This is the same choice Model makes and for the same reason. What startup checks is therefore the shape — one word, no spaces, not absurdly long — and never the vocabulary, because a list held here could only be the list that was true when it was written. A level the model does not know is a request refused, learned on the first question rather than ruled out in advance.

What a model must support for ask_mail to work at all. The answering run offers the model function tools and retrieves mail when the model calls one, so a model that cannot be given tools cannot answer a question here whatever else is declared. Where a reasoning model refuses tools beside a stated effort, Api is the setting that resolves it, and the two are therefore chosen together rather than independently.

Changing the model does not restart the host

The declaration is read again after an edit rather than once while the host composes itself, and the reason is the case an operator actually hits. A model the provider will not serve is only discovered from a refusal on a real question, so correcting one is the ordinary path rather than a rare one — and the process being corrected is synchronizing mailboxes and holding an IMAP IDLE connection. Restarting it to change a string is a cost paid on every correction.

What that means in practice:

  • The next question uses the edited declaration. Every key of the endpoint is in this — the model, the address, the API, the parameters, the bounds, the deadline, the credential reference, and the relevance filter's two numbers.
  • A question already in flight keeps the declaration it began with. A run resolves the declaration once and holds it until it answers, so a reload landing mid-run cannot answer half of one question against one declaration and half against another.
  • A candidate that breaks a rule is refused whole. Everything startup checks is checked again: the bounds, the section's own rules, the deployment-wide alias uniqueness, the filter's agreement with what a retrieval hands over, and whether the credential reference still resolves. A refused candidate is logged with the key an operator has to fix, the previous declaration goes on answering, and the process stays up — which is what makes correcting a mistake in a correction possible at all.
  • Seven things still take a restart, because each decided which services this deployment registered: whether Chat:Models declares a model at all, whether the relevance filter runs, whether arriving mail is derived from — the switch message enrichment is turned on with — whether a correspondence is derived from, the switch a conversation's state is turned on with, whether a typed sentence is read into filters, the switch AI configuration § Chat:SearchPhrasing describes, whether a reply is drafted, which Chat:ReplyDrafting:Enabled decides, and whether an opened contact is read into a relationship card, which Chat:ContactRelationship:Enabled decides. Going from no chat section to one is therefore a restart, and so is turning the second pass, either derivation, the sentence reading, the reply drafting, or the card on or off. Each is refused with that message rather than adopted and quietly ignored. Declaring a further model, renaming one, and moving which alias a capability names are none of them — the credential and the circuit are looked up by whatever the declaration in force calls a model.

ADR 0002 classifies this group as reloadable for new operations and states the rules a reloadable group follows; AI configuration § Chat marks each key.

Bounds every call carries

A turn is text, and it may carry one picture beside that text. What decides whether a format may be sent, how large a grid it may declare, and what the model is being asked about it belongs to whoever composed the turn; what this boundary owns is the ceiling below on how many octets one request carries. An audio clip and a tool result are capabilities rather than shapes this port is missing, and each waits for the caller that needs it.

  • A conversation bound. MaxMessagesPerRequest and MaxRequestCharacters are checked before anything is sent. Both are refusals rather than truncations: cutting a conversation down to fit would send the model a different question from the one it was given and return an answer to that, which no caller could detect. The character ceiling is stated in characters rather than tokens because counting tokens would mean carrying the model's own tokenizer; set it below what the model's context window allows.
  • An image bound. MaxRequestImageOctets bounds the octets the pictures of one request add up to, and is a refusal like the two above. Characters bound an image not at all — a photograph is a turn of a few words and several megabytes — so a conversation carrying one would pass a character ceiling and then be refused by the provider after this deployment had built the request, encoded the octets, and sent them. It is counted as the octets the image occupies rather than as what the request body becomes: every provider this reaches carries an image base64-encoded, which is a third larger again, so the figure a provider publishes for itself is the one to set this below. Writing 0 declares an endpoint that is sent no image at all, which is the right declaration for a model that cannot read one and is a refusal rather than a turn quietly sent without its picture.
  • An explicit timeout. RequestTimeout bounds one request, applied by MailFathom rather than left to whatever the provider library defaults to. A deadline that expires is reported as a timeout rather than as a cancellation, because a cancellation would tell the pipeline that this system stopped the work. Its default is longer than an embedding request's, because generating an answer takes as long as the answer is.
  • One retry layer. The call runs under the AiProviderInvocation resilience pipeline, and both the provider library's own retry policy and the standard HTTP resilience handler are switched off for it. Outbound resilience holds the rule and why two layers multiply rather than add.
  • A bounded response. The transport refuses a body larger than the configured output budget could fill, and refuses redirects — a moved endpoint answering with one would carry the key or the bearer token to whatever host it named. It is a registration of its own rather than a second consumer of the embedding client's, because an answer's size follows the output budget while an embedding response's is fixed by the declared geometry, and one client would have to take the larger ceiling and would then bound neither.
  • A sensitive-content guard, where one is switched on. Every turn is scanned and redacted before the request is sent, above the retry layer, so one call costs one scan whatever the pipeline does and a scanner that cannot answer refuses the call as itself rather than arriving as a fault of the provider's. Both switches are off by default, and nothing is scanned then. Sensitive-content scanning § the guarded egress points holds the contract. A picture passes through unscanned, and that is the honest position rather than an omission: the guard detects regions in a string, there is no such operation for a photograph, and running the octets through a scan that would return them unchanged would claim a protection nobody has. What decides whether an image leaves at all is the deployment's own activation of whatever composed the turn.

An answer that was cut short is still an answer

A call that produced text returns it, together with why the model stopped:

Stop What it means What a caller does
Completed The model finished what it had to say Present it
Output limit reached The output budget cut the generation off Present it with the truncation stated, or ask again with a larger budget
Content filtered The provider's content filter stopped the generation Present it as a refusal — what survives is a fragment
Unreported The provider named no reason Present it, without claiming the model finished

Reporting these on the answer rather than as failures is what guarantees neither is ever repeated as though it were a transport fault: nothing repeats a call that returned something. It is also the honest reading — the text before the stop is real, and the call has already been paid for.

What a failing call is classified as

A call that produced no text at all fails, and says which kind of failure ended it. Collapsing these into "the call failed" gets the next two decisions wrong: a rate limit answered with an immediate retry is how an account gets throttled harder, and a refused credential repeated is how the same refusal is bought again while the account carries the requests.

Classification What it means Repeated?
Credential rejected The endpoint refused the credential presented No — rotate or correct it
Rate limited The deployment is over its allowed rate Yes, after a backoff
Request timed out The endpoint did not answer within the configured time Yes
Transport faulted The request never reached an answer Yes
Request refused The endpoint rejected the request itself — a model it does not serve, a conversation beyond its context window, a parameter it does not accept No — correct the declaration
Answer empty The endpoint ended the call without producing any text No

A caller's own cancellation and a host shutdown are absent from that table on purpose. Both are this system's own decision rather than a remote party's answer, so reporting one as a provider failure would let it open a circuit against a healthy endpoint.

A prompt the provider's own safety system refused before generating anything arrives as "request refused." Telling it apart from any other rejected request would mean reading the provider's error body, and that body quotes the request. The request is somebody's question and, once retrieval exists above this boundary, passages of their mail.

An endpoint the resilience pipeline declined to call at all — a circuit it opened after repeated failures, or a concurrency budget already spent — arrives as a transport fault, which is what a caller waits out.

Provider health is tracked per provider

Each provider records what its last call established, and the two states are kept apart:

State What the last call established What it asks of an operator
Unobserved Nothing has been called yet Nothing. It is the state of a freshly started instance
Serving The last call reached the model and came back Nothing
Unavailable The last call failed for a reason a later attempt may not meet Wait, or look at the provider's own status
Misconfigured The last call failed for a reason no later attempt changes Rotate a credential, or correct the declaration

The split between the last two is the same property the resilience pipeline reads, so the health state and the retry decision can never disagree about whether waiting is the answer.

Serving is about the provider, not about the answer. An endpoint that took the request, authenticated it, ran the model, and came back with no text is a working endpoint — the credential, the address, and the routed model were all right — so an answer empty failure records Serving rather than moving the state. The consequence is worth stating, because it is the one case where a failing capability leaves a healthy-looking provider: a deployment whose model answers with nothing every time reports Serving indefinitely, and what shows the problem is the failures themselves in the log, not this state. Every other classification in the table above moves the state.

A fallback answering leaves the role healthy, and that is the right answer for the question the state is asked. Health is recorded per role rather than per alias, so a deployment whose main model could not be reached and whose fallback answered records Serving: the deployment can answer questions, which is what withholds or offers ask_mail. What the state does not show is that the first model is failing, and the warning written on every fall-through — naming both aliases and the failure that caused it — is what does.

Every other capability records the role's health against whichever model answered it. A deployment that routed enrichment, a thread state, a reply draft, a relationship card, a search reading, a Discover step, a judged candidate, an arranged day or an image description to a model of its own therefore has that endpoint's outcomes deciding the chat role — so a failing cheap endpoint reports the role degraded, and withholds ask_mail, although the model questions are answered with is working. Routing a capability elsewhere is worth knowing for that reason as much as for the bill, and the warning each fall-through writes is what names the endpoint that actually failed.

The body-cleanup pass records nothing, because the state it would write is not about it. Chat:BodyCleanup:Model may name a model of its own, at its own address and under its own credential, and the chat role's state is what decides whether ask_mail is offered. A cleaning endpoint failing says nothing about whether questions can be answered, so recording it there would take a working ask_mail out of service on the strength of an endpoint no question is ever sent to. What shows a cleaning endpoint failing is the failures themselves in the log, and the reader being shown the message uncleaned and told so. Where the pass names the answering model anyway, that endpoint's state is already written by the questions themselves.

Nothing probes a provider to find out. A paid call made to answer a health check would spend an operator's money on every scrape, and the answer would be about a request nobody asked for. What is reported is the outcome of the last real call.

One consequence is worth knowing before reading a Degraded probe: the probe reports the state without its age. The moment the last call ended is recorded, and the health check does not read it, so a provider that failed once during a deployment and has not been called since probes exactly as one that failed a moment ago does. On an instance that embeds continuously the state is as current as the work; on one whose chat provider nothing calls, a stale failure can sit there indefinitely. Read the log records for when it happened.

What does read the age is whatever has to decide whether calling again now would buy anything. Semantic search lets one query through after a minute without a fresh observation, and the answering capability behind ask_mail does the same for the chat endpoint, so a repaired credential is discovered without a restart even though the probe would still be reporting the old state until something calls.

Three things make the states readable:

  • A health check per declared provider, named ai-chat-provider and ai-embedding-provider. Both reach the readiness probe alone and neither ever reports worse than degraded. Neither provider serves a request path — an instance with a failing embedding provider still answers every search lexically, and one with a failing chat provider still answers every search at all — so a failing provider must not take the instance out of traffic, and must never reach the liveness probe where it would restart a process that is working. A deployment that declared only one provider registers only that one.
  • A gauge, mailfathom.ai.provider.health, carrying one measurement per role under the tag mailfathom.ai.provider.role. It publishes the state's own value rather than its name, because an instrument's value has to be a number; the values are allocated once and never reordered. A role nothing has called publishes no measurement, so a flat line always means a provider that is being watched.
  • A log record for each transition, and for nothing else. Losing a capability is written at Warning naming the role, the state it left, and the state it reached; regaining one is written at Information. Only a change is recorded, because every provider call records a state and a line per call would put the log's volume on the size of the mailbox rather than on anything an operator would act on — and a first call that succeeded is not one of those changes, because it restored nothing. A first call that failed is. This is what answers when a state changed, which the state itself deliberately does not carry.

What never reaches a log

No prompt, no answer, no credential, and no provider response body. A prompt is somebody's question and the passages of their mail; an answer is written from both; a provider's own error text quotes the request that produced it. The classification, the endpoint alias, the stop reason, and the token counts are what a log record carries instead.

Token counts are the one part of a call that is safe to keep: a count says how much was sent without saying any of it, and it is what makes a chat provider's cost visible while it is being spent rather than at the end of a billing period.

Model output is treated as untrusted input, because it is written from untrusted input. It is encoded for whatever destination presents it and never interpreted as markup, a command, or a path on the way there.