Commit Graph
461 Commits
Author SHA1 Message Date
host a68b63e0f1 console: API Key 区补生成/列表/撤销(调现有自助接口) 2026-10-29 12:51:00 +08:00
openqj 49f3ff7cb6 Merge pull request #134 from openqj/feat-longtask-docker-resume-env
修法:Docker 断点续跑透传密钥环境(SUB2API_API_KEY 缺失空转)
2026-10-29 12:48:12 +08:00
host 5b2bdc9bbf fix: Docker 断点续跑透传密钥环境(SUB2API_API_KEY 缺失空转修法)
Docker goal_resume_breakpoint_task 是唯一漏传
env=self._docker_cli_env(extra_env) 的 goal 方法:密钥只按名
进 docker run,值靠 CLI 环境带;漏传导致容器内 key 为空,
断点后每轮瞬间报 Missing SUB2API_API_KEY、无限空转
(2026-10-29 长任务实弹:274 轮全失败)。

单测:断言断点方法调用 runner 时 CLI 环境含密钥值,
命令里密钥只按名出现不带值。
2026-10-29 12:42:19 +08:00
openqj c757810097 Merge pull request #133 from openqj/feat-longtask-auto-resume
长任务中断自动恢复:仅用户暂停才暂停,不限时
2026-10-29 11:48:22 +08:00
host c9cfe22a36 feat: 长任务中断自动恢复,仅用户暂停才暂停,不限时
- 新增 tasks 列 paused_by_user/interrupted_reason/auto_resume_count/no_time_limit(幂等迁移,server+worker 双侧)
- POST /tasks/{id}/pause:用户暂停标 interrupted + paused_by_user=1;/cancel 同款标记;人工 /retry、/goal-resume 清标记
- sweep 标 sweep、配额标 quota、协调员孤儿标 coordinator_orphan、worker 退出标 worker_shutdown
- worker.run_loop 每轮后 auto_resume_interrupted:只接系统中断的 goal 任务,CAS 回 queued + goal_resume_pending=1(G10 断点续跑),用户暂停/配额/孤儿/非 goal 不接,上限 50 次防无限烧额度
- no_time_limit=1 的任务 worker/Docker 级不限时(其它任务仍默认 1800 秒;host 单轮 600 秒仍是单轮护栏)
- 前置 cherry-pick:G10 断点续跑透传 model_provider(否则 Docker 断点续跑在 sub2api 下必死,自动恢复无法实证;本 PR  supersedes #127,勿另行合并 #127)
2026-10-29 11:37:06 +08:00
host a19b1567bb fix: G10 断点续跑透传 model_provider(sub2api 续跑失败修法)
断点续跑容器不带 --model-provider 时 Server 的 provider 表里
没有 sub2api,thread/resume 报 provider not found(probe15 实弹)。
Docker/Local 断点方法加可选 model_provider 并转发,worker 两处
调用点传 gateway_provider;补单测断言断点命令含
--model-provider sub2api(旧代码下两新测试 1 失败 1 报错)。
2026-10-29 11:28:39 +08:00
openqj 0ef896c317 Merge pull request #132 from openqj/feat-console-gapfix
console: 分栏改独立容器,修模块间空白间距
2026-10-29 11:04:22 +08:00
host e5aa5c2acb console: 分栏改独立容器,修模块间空白间距
PR #130 的共享网格行是根因:一行高度由该行最高模块决定,
任务列表撑高第 2 行后,对话(第 3 行)只能从任务列表底下开始,
派发/环境等短模块下面空出一大截;align-items:start 只让盒子
不拉伸,拉不上来下一行。

修法:App.tsx 把模块包进三个独立 .dash-col(左:任务+项目,
中:派发+对话,右:环境+Workers+技能+自动化+分诊+管理区+
API Key),栏内 flex 纵向紧贴;中屏两栏(左+中上右下)、宽屏
三栏并排;窄屏用 display:contents + 每模块 order 恢复原单列
顺序。构建产物 316093 字节,sha 与构建输出一致。
2026-10-29 10:56:36 +08:00
openqj e7f7edf5c2 Merge pull request #131 from openqj/feat-readme-update
docs: README 对齐生产现状(main 93c25a9,补 PR #130 自适应分栏)
2026-10-29 10:48:52 +08:00
host b27d98e642 docs: README 基线跟进到 main 93c25a9,补 PR #130 自适应分栏 2026-10-29 10:43:01 +08:00
host da0c7d453e docs: README 对齐生产现状(main 4c3420a)
- 顶部新增项目现状:生产 Postgres + api.diante.me + React 命令台 GitHub 风格
- 新增云端控制面一节:状态机、worker/扩容、配额成本、记忆搜索、继续/计划/followup/fork、部署链路
- 纠正过期表述:云端不再是演示、PR/CI 本仓已走通(旧无远端/无登录已过期)、多机同步走中心库
- 新增诚实边界:内层 bwrap、40 人暂搁置、单机 HA 模拟、PR #127 未合并
2026-10-29 10:42:27 +08:00
openqj 93c25a92bc Merge pull request #130 from openqj/feat-console-adaptive
console: 按宽度自适应分栏(一栏/两栏/三栏)
2026-10-29 10:35:54 +08:00
host c89c157e5d console: 按宽度自适应分栏(一栏/两栏/三栏)
GitHub 风格不变,仅 tokens.css 改布局:窄屏 <900px 一栏
(按原 DOM 顺序堆叠),中屏 900–1399px 两栏(左:任务列表
+ 项目,右:派发 + 对话 + 详情 + 环境 + Workers + 技能 +
自动化 + 分诊 + 管理区 + API Key),宽屏 >=1400px 三栏
(左 310px:任务列表 + 项目,中弹性:派发 + 对话 + 详情,
右 330px:环境 + Workers + 技能 + 自动化 + 分诊 + 管理区
+ API Key),盒子按内容高度不拉伸,页面最大宽 1560px,
窄屏断点修正为 899px 避免与 900px 重叠。console 标记单测
本地 53 项通过。
2026-10-29 10:30:16 +08:00
openqj 4c3420ae8e Merge pull request #129 from openqj/feat-console-github
console: GitHub 风格(Primer)
2026-10-29 10:21:44 +08:00
host e90c885290 console: GitHub 风格(Primer)
保持一页式控制台排版与全部功能、API 不变,只换视觉:
深色顶栏 #24292f、Primer 浅色配色(边框 #d0d7de、链接蓝
#0969da、绿主按钮 #2da44e)、6px 圆角方框、系统字体与
等宽 ID/trace;任务列表改 issues 式(状态圆点 + 标题 +
灰色元信息);对话改评论时间线(白框 + 头部 + 正文,
竖线连接),灰/蓝气泡已移除;自动选项目与继续消息历史
不受影响。console 标记单测本地 53 项通过。
2026-10-29 10:13:30 +08:00
openqj bbe02efc14 Merge pull request #128 from openqj/feat-console-dashboard
console: 一页式控制台排版 + 数据卡片
2026-10-29 10:04:17 +08:00
host 8b455c6554 console: 一页式控制台排版 + 数据卡片
保持 Muse 风格(白底、细线、灰/浅蓝气泡),不再四栏切视图:
顶栏(连接/健康/配额/刷新 + 锚点导航)+ 6 张数据卡片
(健康、配额、任务、Workers、项目、项目数据,均取自已有
store 数据,未加载不以 0 充数)+ 所有模块按顺序铺在一页
(派发、任务列表、对话+详情、项目、环境、Workers、技能、
自动化、分诊、管理区、API Key)。图标栏与右侧栏删除,
内容分别移到顶栏与各自模块下;今天列表与任务列表重复,
不再单独保留;对话为空时不再重复渲染派发表单。
含自动选第一个项目修复(主要聊天不再空)与继续消息
历史,console 标记单测本地 53 项通过。
2026-10-29 09:57:26 +08:00
openqj a13762cfbe Merge pull request #126 from openqj/feat-chat-history
chat: 持久化继续消息,chat-history 交替历史
2026-10-29 07:07:34 +08:00
host f02c513729 chat: 持久化继续消息,chat-history 交替历史
基线 main 811912c(PR #125 Muse 风格之后):服务端与单测与
9538825 相同;React 侧在 Muse 风格 ContinuePanel 上重放
chat-history 集成(新版输入框占位文案保持 Muse 风格的“消息”),
console.html 由新版 src 重新构建。

- 新表 task_continue_messages:POST /continue 的用户消息与状态改回
  queued 同一事务落盘,409 被拒不留 phantom 消息
- GET /tasks/{id}/chat-history:prompt + 继续 + 后续消息 + 链路按
  时间交错拼好返回;部署前继续以 legacy_continue_count 如实标注
- React ContinuePanel 优先用 chat-history,旧服务端自动回退
2026-10-29 07:01:57 +08:00
openqj 811912c841 Merge pull request #125 from openqj/feat-console-muse-style
console: 按 Muse 网页端/桌面端视觉重做
2026-10-29 06:58:11 +08:00
host 66790b5123 console: 按 Muse 网页端/桌面端视觉重做
仅视觉与布局改动,功能与 API 未改:全屏四栏(56px 图标栏 +
260px 列表 + 弹性对话 + 300px 右侧栏),左侧搜索 + 主要聊天
列表,中间灰/浅蓝气泡对话 + 圆角输入条,右侧头像 + 已连接
(真实 key/健康状态)+ 今天任务清单,下方仍可展开原详情。
旧 v3 松绿/朱印与顶部大标题栏已移除,产物为单文件
(316226 字节,sha f8fea987…,本地重建字节一致)。
console 标记单测未动,本地 53 项通过。
2026-10-29 06:52:34 +08:00
openqj 5ca5cc91cc Merge pull request #124 from openqj/feat-console-react
console: React 生产级重写(左列表 + 中对话 + 右详情)
2026-10-29 06:38:35 +08:00
host ebc5624893 console: React 生产级重写(左列表 + 中对话 + 右详情)
旧单页 console.html 换成 Vite + React + TypeScript 单文件构建产物
(309525 字节,sha 90345ec8…,重建字节一致),源码在
cloud/console-react/,改页面只改 src 再 npm run build:console,
产物不手改。布局:左侧列表(模块导航 + 任务列表)、中间标准对话
(实时链路时间线 + 继续会话聊天框,共用 Chat 组件)、右侧详情
(元数据、操作、评审、审批、协调子任务、子代理、线程)。
API 与后端语义未改,key 只存浏览器 localStorage。
6 个 console 标记单测随实现改名更新(意图不变:壳确实调了
这些接口、turn 信息仍在详情里、旧 goal 输入仍不存在);
P1 标记单测未动且通过。
2026-10-29 06:32:38 +08:00
openqj 3f4e849a93 Merge pull request #122 from openqj/feat-pm-wait-deadlock
worker: always start capacity pool threads in run_all
2026-10-29 05:47:32 +08:00
host ebfae7b992 worker: always start capacity pool threads in run_all
run_all previously sized its pool from the ready snapshot at round start (min(capacity, ready_count)). If a round started with only 1 ready task (e.g. a just-claimed PM), only 1 thread ran; that thread entered a marker wait (up to 3600s) after its model turn, and children created/retried mid-round had no free thread to claim them. run_loop is blocked joining that round, so no new round starts; if the other worker had already scaled down, the queued child waited out the full wait timeout unclaimed. Fix: always start capacity threads. Idle threads exit immediately when no task is ready and nothing is active, and poll every 0.2s while something is active, so mid-round arrivals are claimed. Test: run_all with capacity=2, 1 initial task whose mocked run_one creates a child then polls for it; without the fix the PM poll times out in 5s (1 result), with the fix both tasks dispatch in the same round (0.2s).
2026-10-29 05:41:35 +08:00
openqj ab0aaf4a5e Merge pull request #121 from openqj/feat-child-model
feat: 子任务默认模型/强度(child_model/child_effort)
2026-10-29 05:35:51 +08:00
host 14757f15c4 feat: 子任务默认模型/强度(child_model/child_effort)
主任务可显式声明派生默认,或在 prompt 里写“子任务用 gpt-6-luna max”
由服务端解析填入;marker task-create 与协调员分工未显式写模型/强度时
按 块/分工 > 派生默认 > 父任务模型/强度 继承,fork 复制派生默认,
continue 可改派生默认;console 新建/继续表单与任务详情同步展示。
2026-10-29 05:27:22 +08:00
openqj f99e667222 Merge pull request #120 from openqj/feat-marker-wait-heartbeat
worker: heartbeat parent task during marker poll/wait loops
2026-10-29 04:47:33 +08:00
host ccb22c960d worker: heartbeat parent task during marker poll/wait loops
Marker waits run after _run_attempt has cleared _running, so the run_loop heartbeat thread no longer refreshes the waiting parent. sweep_stale_tasks (default 300s) then kills a parent waiting up to the 3600s marker timeout, as seen in the marker live test (PM2 swept mid wait-threads). Poll and wait loops now heartbeat the parent each iteration (interval clamped to <=60s, well under the 300s threshold), best-effort, without touching _running, so no new capacity leak and cancel still works (empty _running entry has no proc/container to kill). Tests: 2 new sweep-survival tests (stale heartbeat at -299s, 2s wait, sweep must spare the parent); both fail 2/2 on pre-fix code and pass with the fix.
2026-10-29 04:40:47 +08:00
openqj fd2309686e Merge pull request #119 from openqj/feat-git-pull-deploy
deploy: add git-pull source for host deployment
2026-10-29 03:45:27 +08:00
host e8e256f6e5 deploy: add git-pull source for host deployment
Host can now fetch code directly from GitHub instead of receiving a VM-built tarball, bypassing the VM->host scp/kex failures and stale-tar risk. Design: VM sends only two small scripts (host_git_fetch.sh + host_deploy.sh, sha-verified via the existing transfer chain, now with a chunk_key fallback that does not need SSH_PASSWORD); host clones via a read-only deploy key (SSH only, HTTPS refused, key must exist with mode 0600), checks out the exact 40-char commit, verifies HEAD, builds a tar in the same format as the VM release (DEPLOYED_COMMIT + RELEASE.json, member names without ./ prefix so host_deploy.sh tar -O works), then calls the unchanged host_deploy.sh for staging swap, backup, health and rollback. Git fetch tolerates the known intermittent host->GitHub degradation: 120s timeout, 3 attempts, 10s sleep, live untouched until host_deploy runs. VM gates: clean tree, tests, commit must be on origin/main, SSH repo only, full sha only; --source tar remains the default. Tests: deploy suite OK, including 6 new host_git_fetch simulations (success with clean tar members, unknown commit, key permissions/missing, HTTPS refusal, short sha) and 4 new deploy.py git-mode helpers plus chunk_key fallback; git-mode dry-run verified against HEAD 630d14f.
2026-10-29 03:37:55 +08:00
openqj 630d14fe07 Merge pull request #118 from openqj/feat-coord-running-leak
worker: release running slot after coordinator completes
2026-10-29 03:07:35 +08:00
host b411a97774 worker: release running slot after coordinator completes
Coordinator tasks bypass _run_attempt, so their _claim placeholder in _running was never cleared: each completed coordinator permanently reduced the worker process effective capacity until it could claim nothing, while heartbeat stayed fresh and the capacity gate returned silently. This caused the 2026-10-28 40-person stall (autoscale-1 had one leaked slot, then claimed coordinator A and filled up) and the old 18-person C-6 never-claim (autoscale-1 leaked both A and B). Fix: wrap the run_one coordinator branch in try/finally _running_clear, so normal and exception paths both release. Also log capacity-gate refusals (worker_claim_refused_capacity) throttled to once per 30s; throttling applies to the log only, refusal always returns False. Tests: coordinator completion releases slot, next claim succeeds, capacity-log throttle; both leak tests fail on pre-fix code.
2026-10-29 02:42:52 +08:00
openqj a367da3ed0 Merge pull request #117 from openqj/feat-autoscaler-coord-guard
autoscaler: guard scale-down against live coordinators and busy victims
2026-10-29 00:37:44 +08:00
host 37b47cadc6 autoscaler: guard scale-down against live coordinators and busy victims
Two veto layers in reconcile(), worker.py untouched:
- Global live-coordinator veto: a running task whose
  coordinator_parts parse (via cloud.coordinator.parse_parts)
  to a non-empty list and whose last_heartbeat is within
  120s blocks all scale-down this round; low_streak is
  frozen, not reset, so scale-down resumes on the next
  low-depth round once the veto lifts.
- Per-victim busy veto: a LIFO victim whose workers row
  is alive with running>0 is skipped, but only when the
  DB also has a live running task (ghost registry rows
  with no live DB task do not block).
- Coordinator-veto query failure fails closed (no stop,
  guard error recorded); victim-veto read failure fails
  open for that layer only.
- A missing/stale workers row is treated as idle.

Tests: 7 new ScaleDownGuardTestCase cases (live/stale
coordinator, non-coordinator, invalid parts, busy/idle
victims, ghost registry, streak freeze); cloud suite
1077 tests OK (4 skipped).
2026-10-29 00:19:30 +08:00
openqj 4cf5888f94 Merge pull request #116 from openqj/feat-automem-pg-replace
fix(db): register auto-memory tables in _OR_REPLACE_PK
2026-10-28 23:01:16 +08:00
host 5d8403e756 fix(db): register auto-memory tables in _OR_REPLACE_PK
Postgres 翻译层对未登记主键的表把 INSERT OR REPLACE 退化为
ON CONFLICT DO NOTHING,致使 memory_settings、task_memory_flags、
memory_extraction_log 首写之后的所有更新静默丢弃(2026-10-28
生产实测:提取日志永远停在首写原因)。补三张表主键登记,并
在翻译层加回归测试(SQLite 原生 OR REPLACE 测不出来)。
2026-10-28 22:49:06 +08:00
openqj ce83dcf586 Merge pull request #114 from openqj/feat-websearch-docker-env
fix: pass search env into Docker task containers (SEARXNG_URL was lost)
2026-10-28 22:22:55 +08:00
host d7f0f1be96 fix: pass search env into Docker task containers (SEARXNG_URL was lost)
Docker tasks do not inherit the worker process environment, they only
get extra_env (-e). SEARXNG_URL in the worker unit EnvironmentFile
therefore never reached codex -> MCP inside the container, so the
auto chain skipped SearXNG and only DuckDuckGo was tried (live e2e:
'all search providers failed: duckduckgo (DNS)').

_docker_task_context now merges any set SEARXNG_URL /
PERPLEXITY_API_KEY / EXA_API_KEY / TAVILY_API_KEY / BRAVE_API_KEY
from the worker environment into extra_env (values never logged;
paid keys follow the same extra_env path as gateway keys).

Tests: 2 new docker-env tests; websearch + tenant isolation = 25
passing; full cloud suite 1038 passing (4 skipped).
2026-10-28 22:17:19 +08:00
openqj ffeed25f50 Merge pull request #115 from openqj/feat-rate-limit-retry-after
429 限流加 Retry-After 头
2026-10-28 20:22:11 +08:00
openqj 7279d0a81c Merge pull request #110 from openqj/feat-marker-tools
任务内标记工具:task-create/task-poll/task-read、wait-threads、task-cancel/task-retry
2026-10-28 20:19:39 +08:00
host 3b2fef95fa 任务内标记工具:task-create/task-poll/task-read 移植、wait-threads 接通、新增 task-cancel/task-retry
- 新模块 cloud/marker_tools.py:纯逻辑解析、校验、快照格式化、
  控制门禁、派生代数与直接上限计数
- sandbox 两处解析提取五种标记块;worker 在 5 处投递点与
  _deliver_peer_messages 同款位置执行,报告排成后续消息下一轮回父任务
- wait 每块 cap 到 8 个目标(与服务端 /wait 对齐,spawn 原先的 10 个收紧),
  每轮最多 2 块;取消/重试门禁:同项目、非自己、非 goal、
  派生链或同创建人,另查 create_task / approve_merge 权限,
  查不到时收紧到仅派生链内
- goal 与协调员任务不解析;单测 30 个,cloud 全量 1043 个、4 跳过、0 失败
2026-10-28 10:13:40 +00:00
host c43eaac4d3 429 限流加 Retry-After 头:值为限流窗口秒数,不改阈值与计数
- _send_json 加 extra_headers 参数,429 返回处传 Retry-After =
  limiter.window_seconds(默认 60),客户端据此退避一个完整窗口,
  不再以原速率 hammer 把自己钉在限流里(Postgres DbRateLimiter
  先 INSERT 再 COUNT,被拒请求本身也计数)。
- 单测:429 响应含 Retry-After 且值等于窗口秒数(默认 60 与注入
  窗口 7 各验一次)。
- 相关单测:test_prod_webhook_exec + test_rate_limit_db 21 个、
  test_server + test_server_endpoints 28 个,全过;cloud 全量未跑。
2026-10-28 10:12:57 +00:00
openqj eae9884b13 Merge pull request #111 from openqj/feat-coord-row-vanished
协调员行消失按中断处理:本体行消失即放槽,子任务行消失按 interrupted 合流
2026-10-28 17:46:23 +08:00
openqj a0b6333f0c Merge pull request #113 from openqj/feat-websearch-worker
feat: websearch MCP worker wiring + egress (public SearXNG route)
2026-10-28 17:36:22 +08:00
host b72a2abae4 feat: websearch MCP worker wiring + egress (public SearXNG route)
Worker --websearch-mcp (default off) seeds tenant codex-home with
websearch MCP on _tenant_dirs (container path); old tenants merge
on next task. Autoscaler unit gains the flag. Tinyproxy filter
adds Perplexity/Exa/Tavily/Brave/DuckDuckGo + exact
searx.diante.me (no diante.me wildcard, control plane stays out).
Tests: test_websearch_worker 4 + websearch_mcp 12 + tenant 7 = 23 OK.
Not pushed, not merged, not deployed; SearXNG host/DNS/nginx and
tinyproxy reload are host steps.
2026-10-28 17:26:31 +08:00
openqj 075908fe58 Merge pull request #112 from openqj/feat-websearch-mcp
feat: web search MCP v1 (oh-my-pi pattern, Python stdlib)
2026-10-28 17:21:19 +08:00
host f8acdffb4a feat: web search MCP v1 (oh-my-pi pattern, Python stdlib)
web_search auto chain Perplexity/Exa/Tavily/Brave/SearXNG/DuckDuckGo
with pinned-provider no-fallback, web_fetch with head+tail truncation,
codex-home seeding helper (idempotent, never writes keys).
Tests: cloud/tests/test_websearch_mcp.py 12/12 (mocked HTTP).
Not wired into worker, not deployed, paid backends not live-tested.
2026-10-28 17:14:22 +08:00
host c38ee8fbe9 协调员行消失按中断处理:本体行消失即放槽,子任务行消失按 interrupted 合流
- _run_coordinator 等待循环里 get_task 为 None 时按取消跳出,
  不再等到 deadline 占槽;终局 CAS 写不回去,最终为 interrupted,
  不写回、不抛错、不当完成。
- _coord_child_rows 对已删子任务合成 interrupted 行并注明行已消失,
  等齐判断不再拖到超时,合流报告标 interrupted 且整体不为 completed,
  其它子任务不受影响;docstring 旧说法同步改成新语义。
- 新增 cloud/tests/test_coordinator_row_vanished.py,3 个单测:
  本体行消失、子任务行消失、正常等齐;cloud 全量 1020 测通过。
2026-10-28 08:57:05 +00:00
openqj 5026e75b2c Merge pull request #109 from openqj/feat-goal-fail-resume
goal 异常退出记 interrupted,可断点续跑
2026-10-28 15:53:35 +08:00