Skip to content

The assistant runs natively with caller-scoped tools - #995

Open
zlareb1 wants to merge 10 commits into
mainfrom
feat/native-loom-assistant
Open

zlareb1 wants to merge 10 commits into
mainfrom
feat/native-loom-assistant

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Related: #993

Changelog category

  • Backward Incompatible Change

Changelog entry

The assistant runs inside Loom with bounded model and tool execution. Configure its provider and model explicitly; the separate assistant service and database are no longer deployed.

Why

The assistant already owns caller authentication, its dashboard and API, tool access, citations and accounting. Executing its model loop in the same process removes a second runtime and its provisioning credentials while keeping each tool call under an answer-scoped viewer token.

The host reads bounded context before the first model turn. Subsequent tool calls remain model-selected, with separate receipts for both origins. Every call passes the authenticated MCP transport. Scope, parent revocation, mirrored-source admission, cancellation, deadlines and cost delivery remain enforced before a successful terminal response.

Scope and risk

This replaces runtime provisioning and streaming orchestration, adds native streaming adapters for the existing provider routes, and removes bundled assistant workloads and database definitions. The dashboard classifies provider configuration failures consistently with readiness and keeps refused-question drafts available during repair. Its browser refusal fixture supplies the native disabled reason rather than treating an unspecified failure as disabled. The HTTP chat route, assistant.ask, Python and TypeScript clients retain their interfaces. Whole answers retain tool publication proofs through accounting and the final response send. Help citations preserve the matching returned section anchor; code citations must match returned source spans. Failed or incomplete model usage retains a labelled cost reservation instead of invented token counts.

No default ranking, embedding model, schema or stored content format changes. The historical provisioning tables and their erasure and credential-rotation coverage remain for retained operator metadata. Credential rotation retains the lease-scoped statement deadline. The offline archive converter accepts a bounded exported format and explicit owner bindings; it creates an exclusive owner-only output file and neither opens an old database nor executes queued work.

Compatibility, rollout and rollback

  • Wire: no operation or input field is added or removed. Runtime error wording and verified code-citation support follow the native implementation.
  • Settings: remove assistant_librechat_url, assistant_service_email and assistant_setup_retry_s. Set assistant_enabled, assistant_provider and assistant_model; provider aliases can use an explicit verified assistant_price_model. New bounds cover model steps, total tools, context bytes, tool/result text, output tokens and total tokens. assistant_answer_ceiling_usd reserves the answer's maximum model cost; zero refuses calls. There is no provider fallback or temperature negotiation.
  • Operator steps: follow docs/operations/assistant.md. Keep retired runtimes stopped and preserve database bytes, named volumes, claims, backups and inert queues. Verify claim and backing-volume retention before removing an old workload. Keep assistant traffic disabled through a mixed serving fleet, then verify an approved provider and caller-bound tools before enabling traffic. No automatic data migration or deletion occurs.
  • Rollback: the schema and retained metadata remain readable. Do not restart a retired runtime or its queues as part of rollback without a separate operator decision. Keep external conversation archives and owner bindings.

Tests

Focused fake-provider tests cover native orchestration and MCP dispatch, explicit provider routing, shared signing and credential refresh, stream terminal markers, cancellation, token and cost bounds, host context before generation, citation validation and cost delivery before DONE. Authorization fixtures cover scope, revocation, narrowed reads, mirrored sources and answer-token attenuation. Ten publication and help-anchor regressions fail before their fixes and pass afterward. Nested MCP fixtures revoke source access after generation, accounting and response headers; whole answer bodies remain withheld. Offline conversion fixtures preserve owner, conversation, message and parent identities and reject unsupported content. CLI regressions reproduce permissive-umask disclosure, verify private output and prevent replacement of existing files or symlinks. A retained-lease regression checks the statement bound and restoration of the caller’s prior timeout.

Focused checks cover support, citations, shared step derivation, protected receipts, backend configuration, authorization, publication and both transports. Configuration tests cover missing model or credentials, unknown or unsuitable pricing, direct-route restrictions and explicitly priced model aliases before admission reads. They use fixture credentials and replayed model frames. The replaced persisted-answer query implementation, its polling tests and its two analyzer shapes are removed; pure receipt assertions and shared protected-event reader integration tests remain. Normal settings and analyzer regeneration completed. Published translation links use the native setup guide; URL regeneration preserves their translated prose and source stamps. The normal offline translation check passes with freshness excluded. Provider protocols, accounting, archive retention, deployment definitions and dashboard behavior also have focused coverage. Full builds, integration, mixed-version checks and repository gates remain required in hosted CI. No live model or benchmark was run for this change.

Reproduce the native provider cases with:

LOOM_ENV_FILE= .venv/bin/python -m pytest tests/unit/test_native_assistant.py tests/unit/test_native_assistant_transports.py tests/unit/test_bedrock_transport.py tests/unit/test_settings_defaults.py -q

AI assistance in the code

  • AI-generated: Codex implemented the runtime and regression fixtures. Source contracts, authorization, retained storage, provider protocols and focused results were checked during development; fresh independent whole review and hosted CI gate shipping.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Full repository gates, frontend builds, integration and mixed-version checks pass in CI.
  • Settings reference, schema, example, snapshots and affected generated contracts are regenerated.
  • No schema migration or destructive storage operation is introduced.
  • Operator documentation describes configuration, cutover, retained data and rollback.
  • Commits are signed off.

@zlareb1
zlareb1 force-pushed the feat/native-loom-assistant branch 3 times, most recently from b8be7c3 to 0c79ca9 Compare November 20, 2026 01:32
Own bounded streaming model turns and authenticated MCP tools in the web process. Validate citations against answer receipts and capture usage before completion. Retain external state and provisioning metadata for an approved cutover.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Streaming requests share endpoint resolution, credential refresh and private
header filtering with the provider transport. Cancellation joins pending
signing before the producer exits. Reuse the deployment region setting and
regenerate its settings artifacts. Verify native enablement with serving TLS.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Whole replies retain nested source-access proofs through required accounting
and response delivery. Citations use returned help anchors, and native
configuration failures remain visible in the dashboard. Retained provisioning
credentials keep their rotation coverage while replaced polling paths are removed.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Route fixtures bind the answer-owned MCP app. Protected ledger fixtures exercise
the pure support rule with all authorization and marked-outcome expectations kept.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Keep authorization, revocation and whole-response publication assertions on
the provisioning-aware credential boundary used by the served routes.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Remove unused persisted-answer query code and preserve receipt-based support
assertions. Cover configuration admission and model-alias pricing, correct
configuration documentation and bounds, and align the disabled chat fixture
with the native refusal contract.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Keep persisted query metadata separate from citation verification and remove
unused support fixtures after the polling path is retired.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Keep step labels and protected-row rules in the shared formatter. Retain the
local-model routing and container networking guidance alongside assistant setup.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Regenerate the published setup destinations when the English guide is replaced.
Keep the translated text and source stamps for the translation updater.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
@zlareb1
zlareb1 force-pushed the feat/native-loom-assistant branch from 0c79ca9 to 4377086 Compare November 20, 2026 02:29
Create converted archives exclusively with owner-only permissions and keep
credential resealing statements inside the retained provisioning lease.
Remove unused ticket and accounting state and obsolete test seams.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant