惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
S
Security @ Cisco Blogs
G
GRAHAM CLULEY
L
LINUX DO - 热门话题
AWS News Blog
AWS News Blog
P
Privacy International News Feed
Cyberwarzone
Cyberwarzone
P
Proofpoint News Feed
腾讯CDC
美团技术团队
宝玉的分享
宝玉的分享
博客园 - 聂微东
小众软件
小众软件
T
Threat Research - Cisco Blogs
L
Lohrmann on Cybersecurity
雷峰网
雷峰网
T
Threatpost
The Hacker News
The Hacker News
P
Palo Alto Networks Blog
L
LangChain Blog
Cisco Talos Blog
Cisco Talos Blog
G
Google Developers Blog
V
Vulnerabilities – Threatpost
NISL@THU
NISL@THU
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Engineering at Meta
Engineering at Meta
T
Troy Hunt's Blog
F
Full Disclosure
博客园_首页
The Last Watchdog
The Last Watchdog
S
Secure Thoughts
H
Heimdal Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
C
Check Point Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
PCI Perspectives
PCI Perspectives
Microsoft Security Blog
Microsoft Security Blog
S
Security Affairs
量子位
Cloudbric
Cloudbric
H
Hacker News: Front Page
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
L
LINUX DO - 最新话题
IT之家
IT之家
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Spread Privacy
Spread Privacy
Forbes - Security
Forbes - Security
Security Archives - TechRepublic
Security Archives - TechRepublic

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
"My Product Assistant Kept Borrowing the Wrong Model. So I Gave It Its Own Routing Chain"
CodeKing · 2026-05-15 · via DEV Community

I do not mind a product assistant being wrong because the docs are unclear.

I do mind it being wrong because it silently used the wrong model source.

That was the real problem I hit in my local AI gateway project, CliGate.

The assistant inside the dashboard had a clear job:

  • answer product-usage questions
  • stay grounded in the manual
  • avoid rewriting settings unless the user explicitly asks

But the runtime path behind that assistant was still too fuzzy. In practice, it could depend on whichever account or API key the broader system happened to resolve first.

That is fine for generic chat.

It is not fine for a product assistant that is supposed to be predictable.

The failure mode was subtle

I already had routing. I already had accounts, API keys, and model mapping. I already had a settings surface.

The annoying part was that the assistant itself still behaved too much like "just another consumer of the default pool."

That created a few bad outcomes:

  • the assistant could drift across providers without the user realizing it
  • clearing a binding could get undone by old migration behavior
  • one flaky credential could make the whole assistant feel unreliable
  • the UI could not answer a simple question like: what is the assistant actually bound to right now?

The bug was not one broken request.

The bug was that the assistant did not have a first-class routing identity.

I stopped thinking in terms of "credential" and switched to "model source"

This is the design change that made the rest of the work much easier.

I did not actually want to bind the assistant to a vague source type like "OpenAI keys" or "Claude account."

I wanted to bind it to a concrete model source:

{
  "type": "api-key",
  "id": "key_x",
  "model": "gpt-5.4"
}

Enter fullscreen mode Exit fullscreen mode

That is why the new config path in CliGate moved toward boundModelSource instead of treating everything as a loose boundCredential.

The internal runtime config now normalizes around that field:

boundModelSource: stored.boundModelSource || stored.boundCredential || null,
boundCredential: stored.boundModelSource || stored.boundCredential || null,
fallbacks: Array.isArray(stored.fallbacks) ? stored.fallbacks : [],

Enter fullscreen mode Exit fullscreen mode

The compatibility alias still exists, but the meaning changed. The assistant is no longer just "attached to a credential." It is attached to a specific source plus an optional model.

That sounds like a naming cleanup. It was actually a control cleanup.

I also needed a way to say "yes, the user configured this on purpose"

One of the uglier problems was legacy migration.

Older assistant settings had source toggles. Newer settings have explicit bindings. If the user cleared the binding, I did not want old migration logic to recreate it on the next restart just because a legacy flag still existed somewhere.

So I added a small but important flag:

"bindingConfigured": true

Enter fullscreen mode Exit fullscreen mode

That flag means:

  • the user has explicitly configured assistant binding state
  • even if the current binding is null
  • do not auto-migrate old sources back into place

This was one of those changes that looks boring in a diff and saves a lot of operator confusion later.

Without it, "clear binding" is not a real action. It is just a temporary suggestion.

The assistant needed an ordered chain, not one brittle primary

Once the assistant had a proper primary binding, the next obvious problem showed up:

what happens when that source is deleted, disabled, rate-limited, or just temporarily broken?

I did not want the answer to be:

"assistant is down."

So the assistant runtime now builds a real chain:

if (config.boundModelSource || config.boundCredential) {
  chain.push(config.boundModelSource || config.boundCredential);
}
if (Array.isArray(config.fallbacks)) {
  for (const entry of config.fallbacks) {
    if (entry && typeof entry === 'object' && entry.type && entry.id) {
      chain.push(entry);
    }
  }
}

Enter fullscreen mode Exit fullscreen mode

That is simple on purpose.

The first tier is the assistant's intended home. The later tiers are not magic discovery. They are explicit ordered fallbacks the user can inspect in the UI.

That matters because fallback behavior should be explainable.

If an assistant changes models under pressure, I want to know exactly why.

A circuit breaker made the assistant feel much less random

Fallback chains are not enough if you keep retrying a dead tier over and over.

So the assistant LLM client keeps breaker state per tier and skips sources that are currently in cooldown:

for (const descriptor of chain) {
  const tierKey = tierKeyFor(descriptor);
  if (this._breaker.shouldSkip(tierKey)) continue;
  const candidate = await resolveCredential(descriptor, {
    defaultChatGptModel: this.defaultChatGptModel,
    defaultClaudeModel: this.defaultClaudeModel
  });
  if (!candidate) continue;
  candidates.push({ ...candidate, tierKey });
}

Enter fullscreen mode Exit fullscreen mode

And when a call fails, the tier records failure instead of pretending the error was just bad luck:

const breakerState = this._breaker.recordFailure(source.tierKey);
logger.warn(`[Supervisor] tier failed | tier=${source.tierKey} | breaker=${breakerState}`);

Enter fullscreen mode Exit fullscreen mode

That changed the experience more than I expected.

Before, the assistant could feel inconsistent in a way users interpret as "the prompt changed" or "the model got weird."

After this change, the behavior became much more operational:

  • try the primary source
  • skip tripped tiers
  • fall through to explicit backups
  • expose the health state in the dashboard

That is a better failure story for a product surface.

The UI finally has something honest to show

This was another reason I wanted the routing chain to be explicit.

Once the backend exposes:

  • the current primary
  • ordered fallbacks
  • resolved source
  • breaker state
  • last used tier

the settings page can stop being a dead form and start being an inspection tool.

The assistant page now has controls for:

  • primary model source
  • per-tier model selection
  • up to three fallbacks
  • breaker threshold and cooldown
  • test-binding checks
  • tier health and last-used status

That is exactly the kind of visibility I wanted when debugging "why did the assistant answer from this provider instead of that one?"

I did not want the assistant to silently test with live requests

There is a small route detail here that I like because it keeps the UI honest.

The binding test endpoint validates whether a descriptor resolves, but it does not fire an actual LLM request:

const result = await describeBinding({ type: body.type, id: body.id });
return res.json({ success: result.ok, ...result });

Enter fullscreen mode Exit fullscreen mode

That means the user gets a fast answer to:

"is this binding even real?"

without turning the settings screen into an accidental prompt runner.

It is a small boundary, but product assistants need that kind of boundary.

The part I trust most is the migration and route coverage

I can write all the assistant architecture docs I want, but the thing that makes me trust this change is the route-level test coverage.

For example, there are tests that pin the new primary field:

assert.deepEqual(res._body.assistantAgent.boundModelSource, {
  type: 'api-key',
  id: 'key-primary',
  model: 'gpt-5.4'
});

Enter fullscreen mode Exit fullscreen mode

And tests that make sure clearing bindings is respected:

assert.equal(res._body.assistantAgent.boundModelSource, null);
assert.equal(res._body.assistantAgent.boundCredential, null);

Enter fullscreen mode Exit fullscreen mode

Those are the kinds of tests that prevent a future "helpful migration" from quietly breaking the operator's intent again.

What changed in how I think about product assistants

I used to think the important part was the prompt and the docs grounding.

Those matter.

But once the assistant becomes part of the product, routing discipline matters just as much.

If the assistant is meant to be:

  • predictable
  • inspectable
  • recoverable
  • configurable without guesswork

then it cannot just borrow whatever account or API key happened to win a broader routing race.

It needs its own routing chain.

The pattern I would reuse

If you are adding a product assistant to an existing app with multiple model sources, I think this is the safer progression:

  1. give the assistant its own explicit primary binding
  2. bind to a concrete source plus model, not just a source type
  3. mark explicit user configuration so legacy migration cannot override it
  4. add ordered fallbacks
  5. add breaker state so failures do not loop forever
  6. expose the whole chain in the UI

That is a lot less glamorous than "ship an assistant."

But it is the difference between a demo assistant and one that operators can actually live with.

If you want to inspect the implementation, the project is here:

CliGate on GitHub

I am curious how other people are handling this. Does your product assistant have its own routing identity, or is it still borrowing the same model path as ordinary chat?