andrexibiza P1-B. ConfigBackendUnavailable subclasses SystemExit on purpose: a fail-open reader
must never serve defaults instead of the selected backend's config, and boot fails closed. That
contract stays. But long-lived consumers caught only Exception, so a plane blip after boot killed
the thread (or, inside an asyncio task, stopped the gateway's event loop).
The six named sites, each with its own outcome:
- gateway/readiness._probe_config: the existence check moved inside the guard; the outage reports
{"status": "degraded", "detail": "config backend unavailable"}.
- cron/scheduler._load_cron_job_config: still refuses defaults (its except Exception lets the
outage through); run_job, the fire's owner, now catches it and returns that fire's failure
result; _run_one_job_body records it like an Exception (mark_job_run(False), finish_execution,
crash notice) instead of re-raising into the ticker.
- cron/jobs._main_model_pin (moved to cron/jobs_model_pin.py to keep jobs.py under its cap):
raises ValueError, so pinned=True create/update is refused as invalid input instead of silently
dropping the lock or exiting.
- tui_gateway/server._profile_configured_cwd: None (logged); the cwd is a hint.
- tui_gateway/server._load_cfg_raw: the designed FailedConfigRead; _refuse_failed_read now
refuses to save it with "could not be read", not "formatting error".
- tui_gateway/prompt_attachments._profile_attachments_storage: "" (logged): attachments stage in
the profile home the sandbox mounts and the vision allowlist cover.
The owners above every other config read on a long-lived path (sweep in the PR body):
- TUI request owner already answers 4064 (_handle_admitted_request); deferred agent-build and
resume-hydration threads now report agent_error / the resume failure and release their waiters;
compute_host turn and frame workers answer turn.error / their error frame.
- gateway platform turn (_process_message_background) notifies the user and ends the turn
instead of re-raising this SystemExit into the loop; api_server gets an outermost
config_unavailable_middleware (503) since entering a profile scope reads config; the served-
profile reconcile watcher and _serve_profile_runtime park the profile for the next rescan.
Tests: tests/plugins/config_backends/test_remote_unavailable_consumers.py (13), each raising the
real ConfigBackendUnavailable from the seam the consumer calls; every production file's fix was
reverted alone and its test(s) went red.
A persistence worker that outlives its cancelled handler holds the store
lock for a whole operation; disconnect() took that same lock on the event
loop, freezing every profile's loop (and the cleanup timeout meant to
bound teardown) until the worker finished.
Review: unsupportedpastels #144911 §2.1.
Review G: a registry reached through a symlink and through its real path
keyed two queued-release sets, so the in-process hide missed and the
capacity refusal came back. And disconnect retired the API turn executor
before site.stop(), so a request landing in that gap minted a fresh
executor nothing retired.
`_submit_api_worker` ran every API-server agent turn (`/v1/chat/completions`, `/v1/responses`
without an Idempotency-Key, `/v1/runs`, `/api/sessions/{id}/chat`) with
`loop.run_in_executor(None, ...)`, and the cron fire endpoint ran whole cron turns with
`asyncio.to_thread`. Both hold a thread of the loop's default executor for the whole turn,
and that pool (min(32, cpu_count + 4) threads) is also the one every `asyncio.to_thread`
SessionDB read in the session handlers uses. Once live turns reached the pool size, every
/api/sessions read queued behind a running turn, and the real turn cap became the pool size
instead of `gateway.api_server.max_concurrent_runs`.
They now run on their own `_UnboundedThreadExecutor`, the same executor class the messaging
and Desktop turns use (`GatewayRunner._get_executor`). Concurrency stays bounded where it is
refused: `max_concurrent_runs` (429 past the cap). The cron fire keeps `to_thread`'s contextvars
copy. The worker-lifetime count and its shutdown close gate are unchanged.
Fixes#144362
Same class as review finding "Messages reach the wrong bot", on the server
side: the /p/hermes/ alias checked only whether 'hermes' was SERVED, so a
host that has a pre-reservation profiles/hermes it does not serve (parked
under multiplexing, or its own daemon next to a single-profile default
gateway) answered traffic addressed to it as the default profile.
The handle now aliases the default profile only when no profile named
'hermes' exists on the host. A rejected /p/hermes/ for an existing but
unserved 'hermes' profile gets its own 404 body (code profile_not_served),
so `hermes peer` reports it instead of reading it as "no such profile" and
falling back to /p/default.
Bot Mode shows every host's default profile as @hermes, but the /p/<profile>/
mirror is keyed by profile name, so `hermes peer dm <peer>/hermes` (and the
message_agent peer route that runs it) got HTTP 404 from every multiplexed peer.
- the client addresses the handle by profile name (/p/default), so an older
peer with no alias of its own is reached too;
- the prefix resolution moves out of the 4k-line api_server facade into
api_server_profile_prefix.py, keeping the server alias and also applying it
on a single-profile gateway.
Refs #118076
A peer's primary (default) profile is always advertised under the reserved
display handle 'hermes' (botHandle() in apps/desktop's hermes-bots plugin),
but the multiplexed gateway's /p/<profile>/ mirror is keyed by the actual
profile name. Nothing mapped the handle back, so /p/hermes/... 404'd while
/p/default/... worked, blocking Bot Mode from reaching a peer's primary bot.
_resolve_request_profile now accepts 'hermes' as an alias for 'default' when
no profile is genuinely named 'hermes', matching the reserved-token handling
already used for display (mentionNameForms in data.ts drops 'hermes' so a
renamed bot can never hijack the alias).
Fixes#118076.
The broker's capability allowlist named only the deleted browser_navigate/click/type/... tools, so a
bound extension controller silently did nothing (review P1-1); owner ruling: remove the feature.
Drops the broker, artifact store, extension router, /v1/browser-control + /v1/artifacts routes,
browser.controller.* RPCs/events (contracts regenerated) and the per-request controller identity.
The authenticated-identity helpers bot relay and session ownership still use move to
gateway/session_identity.py; persisted API admissions carrying 'browser_control' still recover.
Resolves gateway/session_authority.py against #140968: both sides only add instance fields (_route_turns/_route_epochs here, deferred_resets from main); keeps both.
The reset-Bot-Chat fallback added in 2cccb91d11 for
`GET /api/sessions?title=…` returned the titled root even when the user had
archived it on purpose, and it ignored a `source=` filter. That brought an
archived Bot Chat back into `hermes peer dm` routing and broke the listing's
`source` contract. The primary lookup returns `[]` for both.
The fallback now applies the listing's own filters:
- it never returns an archived row (the reaper-archive resurrection below it
keeps handling recoverable archives);
- it returns a hidden row only with `include_hidden`;
- it requires a matching `source` when one is given.
Red -> green: tests/gateway/test_api_server_bot_chat_title_fallback.py (the
archived and `source=telegram` cases returned the row on a40e0c7b15).
Review finding (package 10 independent review, round 2) on #140968
Refs #134889 (LC-23)
Refs #140719
`hermes peer dm` looks up the peer's Bot Chat by exact title before every DM
(`_find_bot_chat`). The listing shows a reset LOCAL lineage as its latest,
untitled segment, so once the Bot Chat had been reset (the overflow auto-reset
from the previous commit, or /new) the lookup came back empty. The client then
tried to create a new Bot Chat, which collided with the title (HTTP 400, "Peer
already has a 'Bot Chat' session but it is hidden ...").
An empty exact-title lookup now falls back to the titled creation id when it
owns a reset local lineage, before the archive resurrection already there. The
chat door admits that id onto the lineage's current segment.
Live-pass finding on #140968 (package 10)
Refs #134889 (LC-23)
Refs #140719
(cherry picked from commit 652a6fc8545017bedca161543c23faed46ff87a7)
dd1a58b2a69 grew api_server.py past its main value (4611 lines) and
_handle_runs to CC 21. The delivered-id read is now inline at its two
call sites, and the /v1/runs retarget is its own helper
(_retarget_to_delivered_chat). No behaviour change.
Check: python3 scripts/check: 12 checks ok (health 0 blocking).
Review finding by @kshitijk4poor on #140973
Refs #134889 (MSG-21)
Refs #140719
After MSG-21 moves an API-held "Bot Chat" title aside, deliver() lands the
peer turn in the newly minted local chat, but the session-chat JSON and
X-Hermes-Session-Id, the SSE headers and events, and the /v1/runs record
(and its idempotency record) still named the requested, now
"Bot Chat (API ...)" id. A client continuing by that id ran a plain API
turn on the old row and split the conversation. Every answer now carries
the delivery receipt's session_id; /v1/runs rewrites its record once
admit_peer_turn returns, which also persists to the idempotency store.
hermes peer dm's JSON reads that body field, so its report follows.
Test: test_a_turn_after_the_move_aside_names_the_local_bot_chat
[chat|stream|run] (red: all three named api_1_stale; green: local-...).
Review finding by @kshitijk4poor on #140973
Review finding by @dokterdok on #140973
Refs #134889 (MSG-21)
Refs #140769
Refs #140719
hermes_state_sessions.py crossed the 2000-line target with the delete/archive
hook calls; the auto-archive wrapper belongs with the sweep it drives in
hermes_state_maintenance.py. Also drops the api_server rollback comment so
that facade does not grow.
Plugins that show the agent's skills (catalog views, "open this skill", drift checks against the
installed copy) need the same walk, order, search roots and lookup gate the skills_list / skill_view
tools use, plus the package hash the bundled-skill sync stores. All seven were private.
Rename, with every internal caller moved and no underscore aliases (same shape as the platform
helpers in e6cf2a9):
- tools/skills_tool.py: find_all_skills, sort_skills, skill_search_dirs, locate_skill,
skill_lookup_path_error
- tools/skills_sync.py: dir_hash
- tools/skill_usage.py: read_skill_name
The names join _PUBLIC in the private-import lint and are documented under "Read the skill catalog"
in the plugin developer guide.
Builds on #129698 by @nekwo, which proposed the same names with legacy aliases kept.
Closes#129696
Co-authored-by: nekwo <beastant1@gmail.com>
A housekeeping sweep keeps a permanent retired-session marker only for an
id a generation walk depends on. _derived_api_sessions picked those API
ids by stored source, and every API session is stored as api_server,
including an id the caller names through POST /api/sessions or
X-Hermes-Session-Id. So once a prune swept such an id, it was refused for
good: POST /api/sessions answered 409 session_deleted and every chat with
that X-Hermes-Session-Id answered 409 not_found, as after a user delete.
- At the sweep, match the derived API ids themselves: every hosted-room
member (bot_room), and the api-<16 hex> ids that _derive_chat_session_id
mints for a header-less chat and implicit_api_session mints for a
chat's or chain's next generation. The id carries its derivation, so
this also holds for sessions an older release bound, whose binding
receipts record no provenance. A caller-named id now ages out at the
horizon; a user delete stays permanent.
- Any id can root a Responses/Runs chain, so a sweep can't recognize one.
When a continuation moves past a swept stored session to its next
generation, the bind of that successor makes the passed markers
permanent (keep_passed_fences, in the binding's write). The Responses
and /v1/runs doors pass the root as walked_from.
- The API adapter's memory registry is keyed by session id: a manager
checked in more than the retry horizon ago is shut down at checkout,
so a session reusing a swept id never gets its predecessor's recall.
Refs #134889Fixes#140731
(cherry picked from commit 23d83c2b13370423661a8332db00e2fd20c28e8f)
Google Chat's HTTP callback awaits the dispatch before it answers, so
unlike Pub/Sub (acked on hand-off) the delivery is not acknowledged yet.
The parked-profile refusal still answered HTTP 200 with nothing
admitted, and the message id stayed in the adapter's dedup cache, so
Google had no reason to retry and a manual resend would be the only way
back.
dispatch_http_event now runs the dispatch inside
parked_route_refusal.retryable_ingress(). Inside that scope,
drop_rejected_route records the refusal instead of sending an in-chat
notice. The adapter then releases what ingress recorded for the
unadmitted delivery (its dedup claim and the DM thread count) and raises
the named ParkedRouteRefused, which the platform-event callback answers
as 503 profile_parked with Retry-After. _dispatch_message swallows
exceptions, so the refusal is carried by the scope, not raised from the
shared helper. Pub/Sub keeps the in-chat notice.
A redelivery of the same event after the profile is served again is
admitted exactly once, and reads its DM thread as the first delivery.
Refs #134889 (GW-12)
Refs #140018
`POST /api/sessions` with the explicit id of a deleted session recreated the
row beside its retired marker and answered 201. The session then listed
fine, but every turn on it answered `not_found`, because the fence is
permanent for a user delete.
The create now reads the fence in the same write transaction and refuses
with 409 `session_deleted`, so the client learns at once and mints a new id.
An explicit id is the client's own name for its conversation, so it is never
remapped to another session the way a derived id is.
Refs #134889 (GW-12)
Refs #140018
`hermes peer dm` creates the remote canonical "Bot Chat" through
`POST /api/sessions` when it is missing. On a headless gateway (no
Desktop/CLI ever made one) that create minted a plain API row. A remote
sender never binds unowned history, so the authority FIFO door
(`admit_peer_turn` -> `session_bot.deliver` -> `resolve_local_target`)
answered every DM 502 "Bot Chat admission refused: not_found".
Under session authority a titled "Bot Chat" create now goes through the
owner's own creation step, the one a first `bot_relay.deliver` already
takes (`session_bot._create_bot_chat`: titled-create lock, commits off the
owner loop). The chat is then a LOCAL session its FIFO owns and the DM is
that chat's own admission. This adds no second creation route and no API
turn. An explicit id, another title, or an existing Bot Chat keeps the
ordinary handler and its answers.
A peer-created API "Bot Chat" left over from before is refused by name
(`bot_chat_not_local`, or `bot_chat_unbound` for unbound legacy local
history) with a remedy, never a bare not_found. The full clause goes to
gateway.log. An existing API-created "Bot Chat" row is not repaired:
it still gets the named bot_chat_not_local refusal and must be renamed
or deleted.
Refs #134889 (MSG-12)
Refs #139162
Refs #139370
Co-authored-by: liuhao1024 <liuhao1024@users.noreply.github.com>
Mechanism: under session authority APIServerAdapter._run_agent hands the turn to
run_api_turn without relay_metadata, and the admission payload had no field for
it, so `body.metadata` (Relay turn metadata) never reached the executing turn.
Main forwarded it to run_conversation(relay_metadata=...) (6ee218602d). The
Responses door already put it in run_kwargs, where it was dropped too.
Fix: _run_agent forwards relay_metadata; admit_api_steps stores a non-empty
dict as api_turn_v1.relay_metadata (validated as a dict by check_api_turn) and
prepare_api_execution exposes it on api_execution for the turn runner. It is
client JSON, so it stays inside the admission's exact-retry identity: a retry
reuses the same request id only via the Responses pointer/replay path, which
never re-admits.
The last hop (TurnRunner passing api_execution['relay_metadata'] to
agent.run_conversation) is in gateway/run_turn_runner.py, owned by another
lane; the exact patch is in NOT_COVERED.md.
Test (red on r13-base2: api_execution has no relay_metadata):
tests/gateway/test_api_relay_metadata_handoff.py admits through the real
admission path and executes through execute_admission.
Review: dokterdok N99
Rest of the on-loop write sweep in the API lane's own files (SWEEP_api-sqlite-on-loop.md):
- api_server_room_dispatch._ensure_hosted_member_session called bind_api_session (a BEGIN
IMMEDIATE binding transaction) from its coroutine; it now drives the same bind_api_steps through
run_steps_off_loop, the ordered off-loop door API admission uses.
- DELETE /api/sessions/{id} ran collect_unheld_api_images (holder check + unlink in one write
transaction) on the loop; it now runs in a worker thread like every other media release.
Neither site can be driven red cheaply by the class test: the room binding needs a hosted-room
catalog fixture, and the delete sweep only blocks when a writer is taken between the delete's own
(already off-loop) commit and the sweep. Covered by the existing hosted-room and media-retention
suites.
Review: dokterdok N32
(cherry picked from commit 4e4d6713288264986f091f5cd50a3caa5f25d834)
Conflicts: tests/hermes_cli/test_finite_chat_delegation.py and
tests/tools/test_completed_process_results.py, where main's lint sweep (0006a5e229) added
check=False to subprocess.run calls this branch had rewritten. Kept the branch's test bodies
and carried check=False onto their subprocess.run calls.
17 conflicts, all from main's lint sweep (ruff UP007/UP017/UP022/UP028/UP031/UP037/UP041,
FURB188/FURB192); no other main commit touches a conflicted file. Resolution: the branch side
of each file plus main's exact autofix (ruff 0.15.10, main's ruff.strict.toml, --fix
--unsafe-fixes). ruff.strict.toml takes main's copy. The pool-retirement live fixture stays
deleted with the pooled backend this branch retires.
The /api/sessions/{id}/chat/stream run hands commentary, deltas, tool progress and approval
prompts from the agent's worker thread to the loop with call_soon_threadsafe, then writes
assistant.completed / run.* / done / None with direct awaited puts. When the worker finishes
before its future is awaited, the await returns without yielding and the terminal frames
overtake a hand-off still waiting in the loop's ready queue: the event lands after the stream's
None and the reader never sees it (traced: commentary queued 20 us after None; ~1 in 360 test
runs in CI). /v1/runs already orders its terminal events with loop.call_soon for this reason.
_SessionEventQueue now counts cross-thread hand-offs not yet applied, and the run awaits
flush() before its terminal frames (after the agent returns and before done). A hand-off to a
closed loop settles its count instead of raising.
New test forces late hand-offs: red on base (commentary missing), green after. Stress, 1,500
turns per process: before 1 miss every 2-3 processes; after 0 misses in 21,000 turns.
Review: https://github.com/NousResearch/hermes-agent/pull/106742
8 conflicts, all from main's lint sweep (#135281 "Harder linter fixes" + the RUF series:
implicit-Optional, unused-unpacked-variable, next(...) for [...][0]). No other main commit touches
a conflicted file. Resolution: the branch side of each file plus main's exact autofix
(ruff 0.15.10, main's ruff.strict.toml, --fix --unsafe-fixes) on it. ruff.strict.toml takes main's
copy (the newly enabled rules). tests/cron/test_bot_chat_delivery_child_env.py stays deleted
(1cc9cb9199 retired its lane).
Under the session authority, APIServerAdapter._run_agent returns early
into run_api_turn() and dropped reasoning_callback, status_callback and
interim_assistant_callback. The admission's API observers only registered
stream-delta and tool sinks, and TurnRunner never gave the agent a
reasoning callback. So /v1/chat/completions (stream) lost
`delta.reasoning_content`, /v1/responses (stream) lost the
reasoning_summary_* events, and both lost hermes.status and Responses
commentary items, while non-streaming responses (read from persisted
messages) still had reasoning. A real GatewayRunner + authority probe with a
loopback model reproduced this: chat_sse/responses_sse reasoning=false,
chat_json/responses_json reasoning=true.
The early return now forwards the three callbacks. observe_api_turn
registers them as admission observers. When an API admission is executing,
_wire_turn_agent_callbacks calls wire_api_observers(), which sets the
agent's reasoning callback and wraps its status/interim callbacks so they
also reach those observers. Each event is fenced to the exact running
claim (check_approval_generation under the stream lock, the same fence as
tool events), so a settled turn's late callback stays inert. Reasoning
still never reaches the shared WS viewer stream. reasoning_callback is
reset on every turn, so a reused cached agent does not keep an earlier API
turn's sink.
Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5462648005
45 conflicts, all from #135177 (lefthook + `ruff check --fix` over 2,366 files). No other main commit
touches a conflicted file. Resolution: the branch side of each file, then main's exact autofix
(ruff 0.15.10, `--config ./ruff.strict.toml --fix`) on it — rewrites only (typing generics, noqa
drops, import forms), no import removed. tests/cron/test_bot_chat_cli_home.py stays deleted
(1cc9cb9199 retired its lane).
Carry the request scope through chat completion execution to the existing durable API ownership field, preserving control ownership beyond adapter-local state.
Validation: tests/gateway/test_api_authority_runs.py, tests/gateway/test_api_idempotency_namespace.py
Implementation and additional regression probes were AI-assisted with GPT-6 Astra.
(cherry picked from commit ecc47e783532bb1840dd709109528cfae6730db7)
API images were committed under `native-inputs/` before binding and receipt checks
ran. Reusing a request id with different image bytes raised `admission_conflict`
but kept the new bytes forever, and deleting an API chat never collected its
images: API media is excluded from per-admission cleanup (it is history context),
and session retirement erases the admission references that held it.
Retained API image bytes are now tied to an accepted admission: `admit_api_turn`
releases the request's committed references after admission unless an admission
holds them (an accepted or exact-retry row does; a refused or retired-retry request
does not). After `DELETE /api/sessions/{id}` and on API recovery at startup,
`collect_unheld_api_images` removes `api_<digest>` images no admission holds.
Collection reuses the existing held-path + physical-identity check, runs on the
loop like capture + admission, and never touches bytes another admission holds.
Review: https://github.com/NousResearch/hermes-agent/pull/106742#discussion_r4213427131
Under the session authority, `_run_agent` returned through `run_api_turn` before the
streaming surfaces' approval notifier was wired, and the advertised `chatcmpl-*` /
`run_*` id was never bound to the canonical admission (whose request id differs).
A canonical approval prompt therefore never appeared on the chat-completions or
session-chat SSE, and `POST /v1/runs/{id}/approval` answered 409 `not_found`
while the turn was blocked on it.
`run_api_turn` now binds the stream's public run id to its exact admission id for
the lifetime of the observing request, and projects the shared `approval.request`
prompt to the stream's existing notifier (same event shape: request_id, choices,
execution_generation). `run_admission` resolves that binding, so replies keep the
existing principal (`api`), run-owner and execution-generation fences.
Review: https://github.com/NousResearch/hermes-agent/pull/106742#discussion_r4211144027
ResponseStore (and its MAX_STORED_RESPONSES default) move unchanged into the
topical sibling gateway/platforms/api_server_response_store.py; api_server
imports it back, so `from gateway.platforms.api_server import ResponseStore`
keeps working. The moved logger keeps the origin's name. Offsets this branch's
growth of api_server.py (code-health FILE_LINES ratchet on PR #106742).
(cherry picked from commit fe95bd6940bc78192a788b5f0baee6518159932a)
12 conflicted files, resolved in three lanes:
- gateway/run.py: take the branch split; main's tirith removal and spool-replay
ordering ported into run_runtime_init.py / run_bootstrap.py.
- config migrations: main keeps v50 (tirith); the branch's bot-chat timeout removal
becomes v51 (_config_version 51, template + test updated).
- hermes_state_usage.py: main's voice_chat task route threaded through the branch's
owner transaction; worker.persist usage allowlist accepts task.
- tui_gateway/server.py: branch side; main's edits applied where the code now lives
(agent_factory, session_registry). Desktop sessions get the catalog toolset on the
authority path; daemon-run finite CLI turns are not watched turns; lazy session info
reports nous/welcome on the free tier.
- Desktop/Ink: one branch-child spinner fix (main's route-token check); main's
uninstall i18n keys kept, pool keys stay removed; voice_turn forwarded and accepted
by the authority submit (surface_v1.voice_turn).
- chat_ws / PTY keepalive test: main's stricter test kept.
Lead fold from the independent review (quality + thermo + 2c + efficiency
lenses, all Low): the fire startup gate and
APIServerAdapter._gateway_is_draining now share runner_is_draining, so a
future drain flag cannot be added to one and missed by the other; the gate
returns early on no runner instead of looping on an unchanging guard. The
cold-adapter test closes its loop and joins its thread, the slow-verify
test keeps the same ordering at a fifth of the wall-clock, and the Chronos
contract doc lists the startup 503.
The code-health ratchet holds gateway/platforms/api_server.py (over the 2k target) at its size on
main, and the startup gate's follow-ups grew it by 7 lines. The handler's runner lookup, startup
gate and live-adapter snapshot now resolve in one call, live_adapters_once_started() in
api_server_fire_startup, which returns (refusal, adapters). The facade ends below main (4619 vs
4621). No behaviour change.
The 7 s startup wait was measured from the gate, which runs after the JWT verify. A slow JWKS
fetch (sync verifiers run off-loop and may hit the network) plus a full 7 s wait could exceed the
dashboard forwarder's 10 s timeout: NAS then sees a 503 and retries while this handler still
claims and runs the job, so it runs twice. The handler now stamps its entry time and the gate's
deadline is measured from it.
The startup gate's refusal was a one-line walrus `if ...: return refusal`, unlike every other
early return in the handler, and the comment explaining why the fire needs the live adapters
(E2EE / relay-fronted platforms have no native credential) was dropped with it. No behaviour
change.
include_unconfigured was hardcoded True in _handle_model_options, so external
API consumers had no way to request the explicit-only view. Forward the
include_unconfigured query param (default true, back-compatible) to
build_model_options_payload. With _append_unconfigured_rows now honoring
model_catalog.excluded_providers, this endpoint no longer resurrects excluded
providers on any view (#68816).
Also lifts model_options decoding (_request_reasoning_config /
_request_service_tier) into gateway/platforms/api_server_request_options.py to
offset api_server.py's frozen line cap (moved code keeps its cap; the facade
re-exports both names).
Gate r1 2c finding (same bug class as #81888): _handle_create_session ran
its own "SELECT id FROM sessions WHERE title = ?" and 400'd whenever any
row held the title, so creating a session named after an abandoned empty
chat still failed even though renaming to that name now succeeds.
Extract the conflict block of _set_session_title into
SessionTitlesMixin._resolve_title_conflict(conn, session_id, title) and
call it from both the rename path and the API create transaction, so the
uniqueness rule (compression ancestor transfer, retired Bot Chat, ended
empty visible ghost, otherwise ValueError) lives in one place. On
ValueError the create still deletes its just-inserted row and returns
400 invalid_title; the message is now the DB's "Title 'X' is already in
use by session Y". A brand-new session has no compression ancestors, so
that branch is a no-op on create. api_server.py net growth is 0.