Skip to content

fix(chat): reuse native quota routing for Argon-first stewards - #7999

Merged
loopx-agent merged 1 commit into
mainfrom
codex/steward-quota-routing-20261103
Nov 3, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/steward-quota-routing-20261103

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Argon quota exhaustion currently strands steward conversations even when the existing Codex account owner has usable capacity. This change lets an explicitly configured Argon-first steward pool fall back to Codex GPT-6.1 Sol and makes ordinary Chat follow native account/provider changes at an unstarted-input boundary. The steward endpoint pool stays separate from Codex App account candidates.

The same Core Session, source binding, original native provenance and existing delivery owner survive a switch. A completed answer with an unsubmitted handoff can use one tools-disabled Codex formatting review; the business input and already delivered prose are not replayed. Unknown-effect failures remain pending. No second watcher, message consumer, account selector or credential store is introduced.

Activation, validation and rollback are documented in packages/loopx-codex-provider-routing/NATIVE.md. The optional provider moves to 0.14.0. Existing pinned/preferred configurations stay unchanged. The existing Settings controls own activation; this PR changes no renderer/layout, so visual review is not applicable. Installed model execution and actual backlog delivery remain post-merge acceptance work.

Validation: 983 Python regressions passed before integration with current main; 655 current-main runtime/package tests, 43 original-source tests and 57 typed tests passed. Standard premerge passed, including RFC pairs, semantic vocabulary and maintainability. A matched original-source fixture fails on the target base because the original worker never receives the format review, and passes on this head with one handoff and no duplicate body. Native Codex startup read back the restricted formatter permissions without dispatching a model Turn.

The three Chat module line ceilings track the bounded owner integrations (agent +23, runtime +64, store +37); global limits and type ceilings are unchanged. The pre-existing oversized Todo renderer is reduced by extracting its unchanged private-declaration validation within the same module. Two SQLite readable-projection assertions reproduce with the same failure on immutable target base and head; the moved validation block is AST-identical, and 71 other projection/declaration/package tests pass. No CI polling is used under this Goal's local-validation policy.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

APPROVE — 本次源码链路满足原来源、原会话及不重复执行的边界;实际安装和模型回传不据此宣布完成。

Exact head: e46e9f3
Base: 34cc688
Reviewer: model_agent; GPT-6; OpenAI; self_reported (exact host execution observation unavailable)

动机

原管家用户在 Argon 额度耗尽后,即使 Codex 额度池仍可用,原消息也无法继续。
原答案已完成但交办格式未提交时,旧 worker 继续等待 Argon;新路径可借用已授权的 GPT 做一次无工具格式复核,并沿原来源提交。
同一原来源用例已验证:一次原业务请求、一次受限格式复核、一次原接收者交办;原正文不重复,新消息仍进入原会话。
本 PR 不重放效果未知的失败请求,不代接收者做业务,不增加消息消费者或账号切换器。
真实模型额度、原服务安装后的运行与积压消息实际回传仍需单独验收;未返回事项继续保留。
普通 Chat 还有另一个同源问题:账号 owner 已换回订阅或切到 API 后,原生线程和常驻进程可能仍保留旧 provider。该路径读取现有 owner 的选择版本,并在尚未开始的新输入处重开同一原生线程;它不自己换号,也不替用户扩充候选池。历史失败继续保留,不以新增日志或候选路由冒充已处理。

改动思路

额度选择留在既有可选 provider,原来源和执行资格仍由 Core 控制;没有第二套账号、队列或消息所有者。
本 PR 交付完整源码链路和受限格式复核;安装后真实推理及原消息回传继续由原服务验收。
配置、额度和原来源是三个不同条件。配置表达选择意愿,额度只给出可用性,Core 再决定该条输入是否允许执行。Python 观察现有宿主与文件并完成原事务;TypeScript 判定额度周期和来源资格。比“失败后重发原 prompt”多出的原生历史和 CAS,是为了保住旧答案和待回传义务,不是第二套业务状态。

触发 原路径 本次路径
Argon 耗尽且已配置备用 仍等待 Argon 核验原生额度池后选 Codex
完成答案、交办未提交 等待原模型格式复核 一次无工具 GPT 格式复核
已开始或效果未知的旧请求 保留原失败 仍保留,不重跑
切换后新消息与状态查询 原会话 同一 Core 会话、原来源

此表仅说明该 exact head 的控制流,不替代执行证据。Argon 的账号/模型/重置周期和硬额度失败一起判断;少量正余额不能清除同一失败周期。Codex 备用只观察既有账号 owner,API 可读模型也不被当作生成额度证明。

具体改动

  1. manager_session_quota_route(loopx/chat_manager.py:942)先核验显式 flexible 池、原模型 pin 和宿主,再复用 native provider 与既有 allocation。旧路径只依据配置与端点可用性;新路径不增加账号选择副作用。
  2. _ensure_adapter(loopx/chat_runtime.py:743)只在已受理但未开始的输入或精确保留的格式任务处切换;启动后再核验配置,ChatSessionStore 原子更新实际执行器并追加旧原生身份。失败保留原身份,新消息和 /status 实测仍复用原会话。
  3. execute_turn(loopx/capabilities/native_chat/external_conversations.py:567)对保留的答案使用无工具、只读、无网络 Codex 格式环境,隐藏格式过程中的正文输出,并验证原接收者和原 context。业务请求不再次发送,旧 Turn/events 不改写,正文不重复。
  4. 可选 provider 更新到0.14.0,英文/中文文档覆盖现有 Settings 的启用、验证、关闭与回退。旧二字段原生历史继续可读,新迁移只追加事实。三个 Chat 文件的规模预算对应实际 +23/+64/+37 行,未放宽全局阈值或类型预算。既有 Todo 超限函数抽出同文件私有校验块,AST 已逐句比对一致,未新增生命周期规则。

spec_ref: docs/architecture/rfcs/app-conversation-and-async-inbox-v0.md
spec_revision: 34cc688
L28-L30:保留 Python IO / TypeScript 身份与范围决策。
L67-L77:原请求/会话/Turn 及模糊回执保留;切换不重新派发业务。
L92-L101:格式任务和最终回传仍核验当前原来源。
L270-L285:原消息身份及正文不重复投递。
L103-L105:安装后的真实提供方、模型和用户收件验收继续保留。

对主干的风险

主要风险是切换把原会话分叉、重复执行历史业务,或把格式复核误当作正常管家执行。对应的真实 Core/原 worker/原生协议测试覆盖新输入、运行中拒绝、配置中途撤销、来源漂移、缺失原证据、旧正常答案、目标/context 篡改及工具步骤。模型和远端提供方在这些测试中为合成边界;另已用真实 Codex 启动并独立读回 formatter 的只读权限,未发送模型 Turn。
655项当前主分支 runtime/package 回归、43项原来源恢复测试和57项类型测试通过;更早的983项完整 Python 回归保留其整合前版本边界。相同原来源用例在 base 因原 worker 不接收格式任务而失败,在 head 验证一次原业务 Send、一次 GPT 格式请求、一次原 handoff 和一次正文;后续来源消息及状态查询保持原会话。standard premerge通过;没有查询或等待 CI。
两个 SQLite readable-projection 断言在同一不可变 base 和 head 均失败:完整长标题不在受限视图、464条记录不全部展开。未删断言、未把失败改称通过;本次移动的私有声明校验 AST 完全相同,71项其余投影/声明/安装测试通过,失败原因不在此变更因果路径。回退通过原服务版本和现有池配置完成,必须保留请求及原生历史。

我的整体评价

这是可直接进入原运行链路的修复:复用账号、配置、会话和回传 owner,避免让用户重复提供已有意图或再次提交业务。条件不充分时留下原义务,而不是虚构成功;条件合格时也不以 plan 或 blocker 代替真正的格式任务和 handoff 提交。完整闭环仍须安装后由原 worker 执行并独立读回实际消息,不能从测试数量推导“积压全部清空”。
本次只修改原消息处理和额度选择路径,没有改 Settings、Chat 或飞书渲染布局。
安装后的真实模型运行、实际原受众回传和端到端可见过程仍待验收。
额度选择留在既有可选 provider,原来源和执行资格仍由 Core 控制;没有第二套账号、队列或消息所有者。
本 PR 交付完整源码链路和受限格式复核;安装后真实推理及原消息回传继续由原服务验收。
未发现阻塞此源码增量的缺陷;两个既有 SQLite 视图测试失败与真实模型额度仍明确保留。合并还须 exact-head readiness 和已有 owner 授权,不把本评审当作新的执行权限。

English verdict: APPROVE. Reuse of the existing native quota owner is confined to an explicitly configured Argon-first endpoint pool and safe input boundaries. The original source, native evidence and delivery owner survive fallback; a restricted formatter never replays business or duplicates the delivered body. Real installed inference and backlog delivery remain separate acceptance work.

@loopx-agent
loopx-agent merged commit 6f90e56 into main Nov 3, 2026
27 of 32 checks passed
@loopx-agent
loopx-agent deleted the codex/steward-quota-routing-20261103 branch November 3, 2026 15:37
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