bailinghub 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +6 -6
- package/README.md +6 -6
- package/docker-compose.images.yml +2 -2
- package/docs/CHANGELOG.en.md +23 -1
- package/docs/CHANGELOG.md +23 -1
- package/docs/CORE_RELIABILITY.en.md +79 -0
- package/docs/CORE_RELIABILITY.md +79 -0
- package/docs/DEPLOYMENT_DIAGNOSTICS.en.md +78 -0
- package/docs/DEPLOYMENT_DIAGNOSTICS.md +78 -0
- package/docs/IMPLEMENTATION_STATUS.en.md +27 -15
- package/docs/IMPLEMENTATION_STATUS.md +27 -15
- package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
- package/docs/INDEPENDENT_VALIDATION.md +4 -4
- package/docs/KERNEL_HOST_API.en.md +2 -0
- package/docs/KERNEL_HOST_API.md +2 -0
- package/docs/MODEL_BILLING.en.md +4 -0
- package/docs/MODEL_BILLING.md +4 -0
- package/docs/MODEL_PROCESS_RECOVERY.en.md +32 -0
- package/docs/MODEL_PROCESS_RECOVERY.md +37 -0
- package/docs/OPERATIONS.en.md +13 -0
- package/docs/OPERATIONS.md +12 -0
- package/docs/README.en.md +7 -0
- package/docs/README.md +7 -0
- package/docs/RELEASE_NOTES_v0.9.2.en.md +45 -0
- package/docs/RELEASE_NOTES_v0.9.2.md +45 -0
- package/docs/RELEASE_NOTES_v0.9.3.en.md +51 -0
- package/docs/RELEASE_NOTES_v0.9.3.md +51 -0
- package/docs/TOOLS_DESIGN.md +1 -0
- package/docs/UPGRADE_v0.9.2.en.md +62 -0
- package/docs/UPGRADE_v0.9.2.md +62 -0
- package/docs/UPGRADE_v0.9.3.en.md +63 -0
- package/docs/UPGRADE_v0.9.3.md +63 -0
- package/package.json +7 -3
- package/scripts/check-doc-links.mjs +4 -0
- package/scripts/check-image-tags.sh +1 -1
- package/scripts/check-release-consistency.test.mjs +2 -2
- package/scripts/doctor-deployment.test.ts +419 -0
- package/scripts/doctor-deployment.ts +357 -0
- package/scripts/doctor.ts +8 -1
- package/scripts/install-secrets.test.mjs +185 -0
- package/scripts/install.sh +10 -6
- package/scripts/publish-images.sh +1 -1
- package/scripts/release-audit.mjs +8 -0
- package/scripts/verify-github-repo.mjs +8 -0
- package/security/dependency-audit-exceptions.json +1 -1
- package/sql/065_usage_reconciliation_scan.sql +4 -0
- package/sql/066_approval_continuations.sql +15 -0
- package/sql/067_delivery_dlq_replay.sql +10 -0
- package/sql/README.en.md +6 -0
- package/sql/README.md +15 -0
- package/src/adapters/llm/file.test.ts +59 -0
- package/src/adapters/llm/file.ts +11 -4
- package/src/app/agent-tool-invocations.test.ts +3 -1
- package/src/app/approval-continuations.mysql.test.ts +138 -0
- package/src/app/approval-continuations.test.ts +351 -0
- package/src/app/approval-continuations.ts +148 -0
- package/src/app/channels-attachments.test.ts +63 -0
- package/src/app/channels.ts +7 -4
- package/src/app/delivery-dlq-replay.mysql.test.ts +139 -0
- package/src/app/delivery-dlq-replay.test.ts +75 -0
- package/src/app/delivery-dlq-replay.ts +41 -0
- package/src/app/delivery.ts +3 -2
- package/src/app/http-server.ts +3 -0
- package/src/app/kernel-model-process-crash.mysql.test.ts +377 -0
- package/src/app/kernel-notification-lifecycle.test.ts +49 -0
- package/src/app/kernel.ts +22 -0
- package/src/app/notification-outbound.test.ts +53 -0
- package/src/app/operational-metrics.test.ts +37 -1
- package/src/app/operational-metrics.ts +25 -2
- package/src/app/outbound.ts +13 -2
- package/src/app/runtime-evidence-maintenance.test.ts +55 -0
- package/src/app/runtime-lifecycle-default.ts +7 -0
- package/src/app/runtime-lifecycle.test.ts +89 -0
- package/src/app/runtime-lifecycle.ts +52 -11
- package/src/app/tool-approvals.ts +2 -1
- package/src/core/contracts/approval-continuation.ts +43 -0
- package/src/core/contracts/delivery-replay.ts +41 -0
- package/src/core/contracts/tools-idempotency.test.ts +121 -5
- package/src/core/contracts/tools.ts +21 -11
- package/src/core/contracts/types.ts +4 -0
- package/src/core/observability/openmetrics.test.ts +28 -0
- package/src/core/observability/openmetrics.ts +91 -0
- package/src/core/platform/http-body.test.ts +185 -0
- package/src/core/platform/http-body.ts +58 -0
- package/src/core/runtime/finish-runtime.test.ts +2 -0
- package/src/core/runtime/finish-runtime.ts +10 -7
- package/src/core/runtime/notification-background-work.test.ts +50 -0
- package/src/core/runtime/notification-background-work.ts +101 -0
- package/src/core/state/approval-continuation.ts +22 -0
- package/src/core/state/delivery-replay.ts +19 -0
- package/src/core/state/state-codec.ts +2 -0
- package/src/core/state/state-contracts.ts +6 -0
- package/src/infrastructure/config/config-approval-ledger.ts +75 -0
- package/src/infrastructure/config/config-delivery-dlq-ledger.ts +36 -10
- package/src/infrastructure/config/configstore.ts +4 -3
- package/src/infrastructure/state/state-jsonl.ts +56 -11
- package/src/infrastructure/state/state-mysql.ts +54 -0
- package/src/modules/usage/background-work.test.ts +28 -0
- package/src/modules/usage/background-work.ts +43 -7
- package/src/modules/usage/billing-reconciliation.mysql.test.ts +163 -0
- package/src/modules/usage/billing-reconciliation.test.ts +85 -0
- package/src/modules/usage/billing-repository.ts +63 -11
- package/src/modules/usage/maintenance.test.ts +78 -0
- package/src/modules/usage/maintenance.ts +39 -0
- package/src/modules/usage/model-gateway.ts +2 -1
- package/src/routes/admin-default.ts +2 -2
- package/src/routes/admin-runtime-default.ts +2 -2
- package/src/routes/admin-runtime.test.ts +1 -1
- package/src/routes/admin-runtime.ts +39 -18
- package/src/routes/admin.ts +1 -1
- package/src/routes/approvals-default.ts +2 -2
- package/src/routes/approvals.ts +30 -33
- package/src/routes/critical-routes.test.ts +16 -3
- package/src/test-support/approval-continuation-crash-child.ts +24 -0
- package/src/test-support/model-process-crash-child.ts +78 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# v0.9.2:安全安装与原记录补续
|
|
2
|
+
|
|
3
|
+
[English](RELEASE_NOTES_v0.9.2.en.md)
|
|
4
|
+
|
|
5
|
+
版本日期:2026-10-13。相对公开 Core 0.9.1 的补丁更新。
|
|
6
|
+
|
|
7
|
+
模型已经返回结果,但结算仍在 pending;审批已经批准,但一次临时故障让原任务停在队列外。百灵中枢(BailingHub)0.9.2 让这些持久记录在没有新请求的情况下继续核对和补续,并修复安装时安全随机源失败仍可能生成凭据的问题。
|
|
8
|
+
|
|
9
|
+
## 修复了什么
|
|
10
|
+
|
|
11
|
+
### 安全随机失败时停止安装
|
|
12
|
+
|
|
13
|
+
新建配置时,默认六项凭据分别通过安全随机源生成。缺少 OpenSSL、随机命令失败或输出不合法时,安装器停止,不写半份 `.env`,不启动服务。已有 `.env` 保留,包括运营者修改的管理员密码。部署方需提供可用的 OpenSSL;不使用时间戳或摘要充当随机源。
|
|
14
|
+
|
|
15
|
+
### 没有流量也推进异步结算
|
|
16
|
+
|
|
17
|
+
过去依赖请求触发的核对,现在由 standalone 启动及每分钟维护自动推进;managed Kernel 由首个及后续既有 `tick()` 推进。每页最多 50 条,按游标前进并回绕,无法计价或单条损坏的记录不再反复占据首批、阻塞后面的记录。
|
|
18
|
+
|
|
19
|
+
核对使用原请求已保存的计量、参考价格与统一倍率,不读取生成正文,不调用供应商或重派模型。缺少可靠计量继续保留 pending/unknown,不猜成零费用。同一 owner 的工作合并,数据库故障退避;关闭先停止新维护,再等待已开始的写账,超时保留同实例工作供重试。
|
|
20
|
+
|
|
21
|
+
### 原审批决策可持久补续
|
|
22
|
+
|
|
23
|
+
外部回调和控制台在同一事务保存决策及补续记录。审计或入队临时失败后,可使用原 `decision_id` 重试;后台维护也会推进未完成补续。决策已保存但补续失败返回 `503` 和 `decision_recorded=true / continuation_pending=true`,不要为恢复另造审批单。
|
|
24
|
+
|
|
25
|
+
原任务入队与决策标记原子保存,并在入队临界区重验审批是否已消费。入队成功但确认丢失、进程重开或后续任务已经完成时,同一决策仍不会再次入队。审批已消费的记录不重排;没有新补续记录的历史决策不自动回填。拒绝仅补审计;Agent 直调仍由原 Agent 使用原 `invocation_id` 显式续执行,批准不会启动中枢模型循环。
|
|
26
|
+
|
|
27
|
+
## 新增诊断与公开回归
|
|
28
|
+
|
|
29
|
+
`npm run doctor -- --deployment --url <Core URL>` 增加只读部署模式,默认核对 `/health`、`/version` 与本地制品身份。显式 `--readiness` 才让服务端检查数据库和迁移账本;诊断不执行升级、回滚或迁移。声明一致不能代替制品摘要、实际数据库身份或目标部署验收,详见[诊断范围与退出码](DEPLOYMENT_DIAGNOSTICS.md)。
|
|
30
|
+
|
|
31
|
+
本版还首次发行实际子进程 `SIGKILL` 和 MySQL COMMIT 确认丢失的模型恢复专项。它验证已有原请求恢复和结算语义,属于测试覆盖新增,不是新的自动重派功能。审批专项也覆盖不同 PID 恢复、确认丢失和并发补续。见[模型进程恢复回归](MODEL_PROCESS_RECOVERY.md)与[Core 可靠性回归](CORE_RELIABILITY.md)。
|
|
32
|
+
|
|
33
|
+
## 谁需要升级
|
|
34
|
+
|
|
35
|
+
- **Core 管理员**:使用安装器、模型计费或外部/控制台审批的部署,建议升级并应用 065/066;升级前保留配置、数据库、原请求与回滚制品。
|
|
36
|
+
- **嵌入式及自定义仓储开发者**:保留公平 `tick()` 与 `close(drainMs)`,配套 continuation ledger 方法和 `RuntimeStateStore.requeueApprovedJobOnce`。缺少配套实现时新审批决策明确 unavailable,不退回旧的不可靠入队方式。
|
|
37
|
+
- **业务后端及客户端接入方**:业务声明、验签和最终权限沿用既有契约;审批重试保留原决策标识,结果恢复保留原调用标识。MCP / Agent Client SDK 0.7.0、DSH 0.7.0 不变。ACC、独立 Host 与客户端各自发布,不包含在本次 Core 补丁中。
|
|
38
|
+
|
|
39
|
+
## 升级与确认
|
|
40
|
+
|
|
41
|
+
相对 0.9.1 新增 `065_usage_reconciliation_scan.sql` 与 `066_approval_continuations.sql`。通过 `npm run db:init` 或官方显式 Kernel 迁移入口应用全部未执行文件;运行时不自动迁移。先协调旧写入并核对迁移与仓储配套,再启动新版本。[升级指南](UPGRADE_v0.9.2.md)包含保留数据、原 ID 核对、诊断与回退步骤。
|
|
42
|
+
|
|
43
|
+
确认新制品身份、迁移账本与健康状态后,在专用测试环境核对无流量结算、审批故障补续和关闭等待。公开回归使用隔离数据库与合成供应商;它们不代表真实供应商或生产业务已验收。队列准入去重也不等于外部业务效果恰好一次。
|
|
44
|
+
|
|
45
|
+
[升级指南](UPGRADE_v0.9.2.md) · [完整版本记录](CHANGELOG.md) · [能力与证据索引](IMPLEMENTATION_STATUS.md) · [上一版本](RELEASE_NOTES_v0.9.1.md)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# v0.9.3: bounded bodies and reliable notification shutdown
|
|
2
|
+
|
|
3
|
+
[简体中文](RELEASE_NOTES_v0.9.3.md)
|
|
4
|
+
|
|
5
|
+
Version date: 2026-10-14. A patch update from public Core 0.9.2.
|
|
6
|
+
|
|
7
|
+
Core previously buffered a complete oversized tool response or remote attachment before rejecting it. Graceful shutdown could release resources before callbacks, notifications or dead-letter records finished, and executor-notification replay could select a native channel incorrectly. BailingHub 0.9.3 fixes these boundaries and adds read-only visibility into existing maintenance.
|
|
8
|
+
|
|
9
|
+
## Fixes
|
|
10
|
+
|
|
11
|
+
### Enforce HTTP and attachment limits while reading
|
|
12
|
+
|
|
13
|
+
Business-tool HTTP bodies have a separate default **5 MiB** transport budget. Excessive `Content-Length` allows early rejection; absent or understated lengths and compressed responses still undergo chunk-by-chunk checks of actual fetch-decoded bytes. Overflow requests cancellation and discards partial contents. Model views default to **8 KiB** and audit payloads use **64 KiB**, now measured as UTF-8 bytes rather than character counts.
|
|
14
|
+
|
|
15
|
+
Remote files retain configured `max_bytes` (**20 MiB** by default), and channel attachments have a **20 MiB** download budget, both checked during reading. Download bounds do not guarantee archive-expansion or parser resource usage.
|
|
16
|
+
|
|
17
|
+
HTTP 200 headers and partial contents do not establish a completed write. A dispatched write with body loss or overflow retains its original Job / invocation, idempotency identity and unknown outcome without automatic redispatch.
|
|
18
|
+
|
|
19
|
+
### Drain actual notification work during graceful close
|
|
20
|
+
|
|
21
|
+
Each Kernel tracks actual callback, delivery, approval-webhook, alert and DLQ work, draining it before resource closure within the shared close budget. Accepted work can register child continuations. Standalone also waits for already-started maintenance producers after stopping timers. Timeouts retain same-instance work and dependencies for a later `close()` attempt.
|
|
22
|
+
|
|
23
|
+
This covers graceful shutdown; completing a drain does not mean every message was delivered. This release does not provide a durable outbox for all notification intents or promise complete HTTP notification recovery after SIGKILL.
|
|
24
|
+
|
|
25
|
+
### Replay the original executor notification child
|
|
26
|
+
|
|
27
|
+
Native channels retain native delivery. Executor DLQs verify kind, original child, recipient and content before requeueing that notification child, retaining full input and request/job identities without rerunning its business parent.
|
|
28
|
+
|
|
29
|
+
Admission and a permanent marker are saved atomically for the same DLQ. Concurrent retries, a lost admission acknowledgement or failed resolve cannot admit it again. `queued` acknowledges admission, not recipient receipt; a later failed execution creates a new DLQ that may be handled separately. Conflicting bindings fail explicitly. Unsupported custom adapters return unavailable rather than using the wrong channel. JSONL remains single-writer.
|
|
30
|
+
|
|
31
|
+
## Additional maintenance metrics
|
|
32
|
+
|
|
33
|
+
The existing optional `/metrics` endpoint adds in-flight work and oldest age, completed/failed totals, recent-run timestamps, drain state/timeouts, latest settlement/approval page progress and settlement backoff.
|
|
34
|
+
|
|
35
|
+
The maintenance collector reads owner-local memory without querying business details, triggering reconciliation or contacting models. Labels use fixed categories, excluding account, principal, job, payload and credential data. Counters reset with owner recreation. Latest-page progress is not persisted total backlog, and continuation completion is not a receipt acknowledgement. See [operations](OPERATIONS.en.md).
|
|
36
|
+
|
|
37
|
+
## Who should upgrade
|
|
38
|
+
|
|
39
|
+
- **Core operators** using business HTTP tools, remote attachments, notifications or DLQs should upgrade. Preserve configuration, data, queue state and rollback artifacts before explicitly applying 067.
|
|
40
|
+
- **Embedded and custom-adapter developers** retain fair `tick()` calls and `close(drainMs)`. Executor replay requires matching `ensureExecutorReplay`, `RuntimeStateStore.requeueDeliveryJobOnce` and atomic semantics.
|
|
41
|
+
- **Business-backend and client integrators** retain original invocation identities, business idempotency and final authorization, and check response download budgets. MCP / Agent Client SDK 0.7.0 and DSH 0.7.0 remain unchanged. ACC, clients and independent Hosts release and deploy separately, outside this Core patch.
|
|
42
|
+
|
|
43
|
+
## Upgrade, verify and understand limits
|
|
44
|
+
|
|
45
|
+
Since 0.9.2, `067_delivery_dlq_replay.sql` adds DLQ kind, original notification child/replay identity and a separate Job admission marker. Apply 067 through the official explicit migrator before all new Core MySQL DLQ reads/writes, including native-channel record/get; startup does not migrate automatically. Legacy rows are not bulk-classified by guesswork; replay verifies original jobs. See the [upgrade guide](UPGRADE_v0.9.3.en.md).
|
|
46
|
+
|
|
47
|
+
Public regressions cover bounded bodies, Unicode budgets, unknown write outcomes, graceful close, original notification replay and metrics isolation. Dedicated MySQL tests cover upgrading from 0.9.2, concurrent admission, acknowledgement exceptions after real COMMIT, failed resolve and store reopening. Notification tests check storage interruption boundaries, not actual process killing, live-channel receipt or production acceptance. See [reliability and regression entry points](CORE_RELIABILITY.en.md).
|
|
48
|
+
|
|
49
|
+
Dependency versions are unchanged. The existing exact Mammoth library-only audit exception still expires at **2026-11-09 00:00 UTC**, without broadening or renewal; this does not claim an advisory-free dependency audit.
|
|
50
|
+
|
|
51
|
+
[Upgrade guide](UPGRADE_v0.9.3.en.md) · [Full changelog](CHANGELOG.en.md) · [Capability and evidence index](IMPLEMENTATION_STATUS.en.md) · [Previous release](RELEASE_NOTES_v0.9.2.en.md)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# v0.9.3:有限收包与通知可靠收尾
|
|
2
|
+
|
|
3
|
+
[English](RELEASE_NOTES_v0.9.3.en.md)
|
|
4
|
+
|
|
5
|
+
版本日期:2026-10-14。相对公开 Core 0.9.2 的补丁更新。
|
|
6
|
+
|
|
7
|
+
业务工具返回过大正文,或远程附件超过限额时,Core 过去会先收完整包再拒绝。一次正常关闭也可能在回调、通知或死信记录完成前释放资源;执行器通知的死信重投则可能走错原生渠道。百灵中枢(BailingHub)0.9.3 修复这些边界,并让既有后台维护进度可被只读观察。
|
|
8
|
+
|
|
9
|
+
## 修复了什么
|
|
10
|
+
|
|
11
|
+
### 收包时执行 HTTP 与附件限额
|
|
12
|
+
|
|
13
|
+
业务工具 HTTP 正文新增独立的默认 **5 MiB** 传输预算。过大的 `Content-Length` 可以提前拒绝;缺少、低报长度或压缩响应仍按 fetch 解码后的实际字节逐块检查。超限请求取消下载,丢弃部分正文。模型回流默认 **8 KiB** 和审计载荷 **64 KiB** 的预算分别按 UTF-8 字节截断,不再把字符数当字节数。
|
|
14
|
+
|
|
15
|
+
远程文件沿用配置的 `max_bytes`(默认 **20 MiB**),渠道附件下载为 **20 MiB**,均在收包时检查。下载预算不保证压缩包展开或解析器的资源用量。
|
|
16
|
+
|
|
17
|
+
HTTP 200 响应头和部分正文不是已完成写入的证据。已尝试外发的写操作遇到正文超限或丢失时,继续保留原 Job / invocation、幂等标识和结果未知状态,不自动重发。
|
|
18
|
+
|
|
19
|
+
### 正常关闭等待通知的实际收尾
|
|
20
|
+
|
|
21
|
+
每个 Kernel 登记回调、送达派生、审批 webhook、告警和 DLQ 写入的实际工作,在释放资源前按共同关闭预算排空;已接受的工作可以登记后续子工作。standalone 停止定时器后也等待已开始的维护生产者。超时保留同实例工作和依赖,等待后可重试 `close()`。
|
|
22
|
+
|
|
23
|
+
这是正常关闭保证,完成排空不等于每条消息成功送达。本版未建立覆盖全部通知意图的持久 outbox,不能承诺 SIGKILL 后全部 HTTP 通知自动补投。
|
|
24
|
+
|
|
25
|
+
### 执行器死信重投原通知子任务
|
|
26
|
+
|
|
27
|
+
原生渠道仍使用原生送达。执行器通知死信先核对类型、原通知子任务、收件人和内容,再重排原通知子任务;保留其完整输入、request/job 标识,不能重跑业务父任务。
|
|
28
|
+
|
|
29
|
+
同一死信的入队和持久标记原子保存,并发请求、入队成功但确认丢失或 resolve 失败不会再次入队。返回 `queued` 只表示入队,不表示收件方已收到;再次执行失败形成的新死信可另行处理。绑定冲突明确失败,自定义仓储未配套时返回 unavailable,不降级到错误渠道。JSONL 仍只支持单 writer。
|
|
30
|
+
|
|
31
|
+
## 新增后台维护指标
|
|
32
|
+
|
|
33
|
+
既有可选 `/metrics` 端点新增后台在途数、最老在途年龄、完成/失败数、最近运行时间、排空状态与超时数,以及结算/审批最近一页进度和结算退避。
|
|
34
|
+
|
|
35
|
+
维护采集器只读 owner 内存,不查询业务明细、不触发核对或模型请求。标签仅使用固定类别,不包含账号、主体、任务、正文或凭据。计数随 owner 重建重置;最近一页进度不是持久积压总量,工作完成数不是收件方确认数。见[运维指标](OPERATIONS.md)。
|
|
36
|
+
|
|
37
|
+
## 谁需要升级
|
|
38
|
+
|
|
39
|
+
- **Core 管理员**:使用业务 HTTP 工具、远程附件、通知或 DLQ 的部署,建议升级;先保留配置、数据、队列和回滚制品,再显式应用 067。
|
|
40
|
+
- **嵌入式及自定义仓储开发者**:继续公平调用 `tick()` 和使用 `close(drainMs)`;执行器重投需配套 `ensureExecutorReplay`、`RuntimeStateStore.requeueDeliveryJobOnce` 及其原子语义。
|
|
41
|
+
- **业务后端及客户端接入方**:保留原调用标识、业务幂等和最终权限;确认工具正文符合下载预算。MCP / Agent Client SDK 0.7.0、DSH 0.7.0 不变。ACC、客户端和独立 Host 各自发行、部署,不包含在本次 Core 补丁中。
|
|
42
|
+
|
|
43
|
+
## 升级、验证与未覆盖范围
|
|
44
|
+
|
|
45
|
+
相对 0.9.2 新增 `067_delivery_dlq_replay.sql`,为 DLQ 保存类型、原通知子任务与重投标识,为 Job 保存独立入队标记。启动新 Core 的全部 MySQL DLQ 读写前必须使用官方显式迁移器应用 067,包括原生渠道 record/get;启动不自动迁移。旧数据不批量猜测类型,重投时核对原任务。见[升级指南](UPGRADE_v0.9.3.md)。
|
|
46
|
+
|
|
47
|
+
公开回归涵盖有限收包、Unicode 预算、未知写结果、正常关闭、原通知重投和指标隔离;专用 MySQL 专项覆盖从 0.9.2 升级、并发及真实 COMMIT 后的确认异常、resolve 失败和仓储重开。通知专项是仓储断点测试,不是实际杀进程、真实渠道送达或生产验收。见[可靠性契约与回归入口](CORE_RELIABILITY.md)。
|
|
48
|
+
|
|
49
|
+
依赖版本未更新。既有 Mammoth library-only 精确审计例外仍于 **2026-11-09 00:00 UTC** 到期,未扩大或续期;这不是全量依赖审计无告警的声明。
|
|
50
|
+
|
|
51
|
+
[升级指南](UPGRADE_v0.9.3.md) · [完整版本记录](CHANGELOG.md) · [能力与证据索引](IMPLEMENTATION_STATUS.md) · [上一版本](RELEASE_NOTES_v0.9.2.md)
|
package/docs/TOOLS_DESIGN.md
CHANGED
|
@@ -267,6 +267,7 @@ X-Bailing-Idempotency-Key: 副作用调用的稳定幂等键(只读/声明幂
|
|
|
267
267
|
|
|
268
268
|
- **签名只有一套:`sha256=`(算法名,非版本号)**。构造 = `sha256=` + `HMAC_SHA256(secret, "<ts>.<METHOD>.<path?query>.<sha256(body)>.<On-Behalf-Of>.<Job-Id>")`,把"谁、为哪个任务"也钉进 HMAC,杜绝窗口内重放篡头换租户/绕幂等。**spec 拉取共用同一套构造**(无操作主体/任务,三者签空串、GET body 也空),300s 时间窗。中枢只发 `sha256=`,`Verify` 与三份单文件参考(`docs/examples/bailing-tool-verify.{php,mjs,py}`)也只验 `sha256=`;
|
|
269
269
|
- 超时默认 10s(provider 的 `timeout_ms` 可配)。只读或显式声明幂等的调用可按路由重试策略重新执行;副作用调用不得把超时、断连或审计降级伪装成可安全重试;
|
|
270
|
+
- 业务工具 HTTP 响应另有固定 **5 MiB** 收包预算,与模型回流 **8 KiB**、审计字段 **64 KiB** 的 UTF-8 字节预算独立。先检查过大的 `Content-Length`,仍逐块累计 fetch 解压后的正文 bytes;缺失或低报长度不能绕过上限。超限立即请求取消正文,不接受部分正文作为成功证据;已尝试外发的写操作仍按原 Job / invocation 与幂等键对账,不自动补发。该上限属于 Core 运行时,没有新增 ACC 字段;
|
|
270
271
|
- **副作用执行日志**:对于非只读、非声明幂等的业务工具,中枢在外发前持久化 `dispatching`,收到 HTTP 响应后写 `response_recorded`,结果审计与终态账本都成功后才写 `completed`;
|
|
271
272
|
- **账本缺失即拒绝**:运行时没有持久化执行日志,或无法在外发前写入占位时,副作用工具直接拒绝且请求不会发出;不能退回“先调用、成功后再记”的旧模式;
|
|
272
273
|
- **不确定结果冻结**:超时、网络断连、进程重启后遗留的 `dispatching`、结果审计失败形成的 `evidence_degraded`,以及响应已记录但终态提交失败形成的 `response_recorded`,都会返回结构化 `reconciliation_required`,并明确 `auto_retry_allowed=false`。恢复任务会在调用模型前扫描未决执行日志;同一任务再次执行时不依赖模型重新选中该工具,也不会向业务系统外发第二次请求;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Core v0.9.2 patch upgrade guide
|
|
2
|
+
|
|
3
|
+
[简体中文](UPGRADE_v0.9.2.md)
|
|
4
|
+
|
|
5
|
+
Upgrade public Core 0.9.1 to 0.9.2 for installation secrets, asynchronous settlement maintenance and approval continuation fixes, plus read-only deployment diagnostics and process recovery regressions. MCP / Agent Client SDK and DSH remain at 0.7.0. This upgrade concerns Core; other components verify and release within their own projects.
|
|
6
|
+
|
|
7
|
+
## Preserve data and coordinate writers
|
|
8
|
+
|
|
9
|
+
Back up the target database. Preserve configuration and credentials, attachment storage, original requests and approvals, previous artifacts and host persistence. Stop new work and coordinate all writers sharing the state database. Check original in-flight requests and saved decisions before draining and closing instances. Retain original `operation_id`, `invocation_id` and approval `decision_id`; do not replace recovery with a new request.
|
|
10
|
+
|
|
11
|
+
The 0.9.1 usage shutdown drain remains effective. New 0.9.2 maintenance writes also participate in close draining. After a timeout, wait and retry on the same instance; do not force-close stores or redispatch requests.
|
|
12
|
+
|
|
13
|
+
## Select artifacts and migrate explicitly
|
|
14
|
+
|
|
15
|
+
Use formal `v0.9.2` source, npm packages or images. Verify version, source Tag/commit and artifact digest. Installer and prebuilt-image Compose defaults are updated to 0.9.2; existing `.env` files are preserved. Creating configuration requires working OpenSSL. Repair randomness failures before retrying installation.
|
|
16
|
+
|
|
17
|
+
Apply all outstanding files through the official migrator. For source installations:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm run db:init
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Embedded hosts use the explicit official `migrateBailingHubCoreSchema` port and recheck the complete `BAILINGHUB_CORE_ARTIFACT_V1` artifact manifest. Startup does not migrate automatically. The migrator skips recorded files; do not edit historical SQL or migration records manually.
|
|
24
|
+
|
|
25
|
+
| Migration added since 0.9.1 | Purpose |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| `065_usage_reconciliation_scan.sql` | Add the `(billing_state, updated_at, id)` paging index, without recalculating historical charges |
|
|
28
|
+
| `066_approval_continuations.sql` | Add the continuation table and `bz_jobs.approval_continuation_keys` for original-decision continuation and permanent admission markers, without backfilling historical decisions |
|
|
29
|
+
|
|
30
|
+
Apply 066 before enabling new approval paths. Failed continuation writes roll back the decision rather than leaving an orphaned decision. Earlier versions also apply all missing preceding migrations; see the [0.9.0 guide](UPGRADE_v0.9.0.en.md) for model billing upgrades.
|
|
31
|
+
|
|
32
|
+
## Match adapters and callers
|
|
33
|
+
|
|
34
|
+
Upgrade official MySQL/JSONL state adapters together with the configuration approval ledger. JSONL serial writes support only one writer; multiple processes must not write the same file. Custom configuration adapters implement `decideWithContinuation`, `getContinuation`, `pendingContinuations`, `markContinuationAuditRecorded` and `completeContinuation`. Custom state adapters implement `RuntimeStateStore.requeueApprovedJobOnce` with matching atomic semantics. Unsupported new decisions return `approval_continuations_unavailable`, without falling back to the old queue path.
|
|
35
|
+
|
|
36
|
+
External retries of the same decision retain its original `decision_id`. A `503` with `decision_recorded=true / continuation_pending=true` means the decision was saved and continuation awaits recovery. Console retries retain the original approval. Historical decisions without new continuation records are not backfilled; consumed approvals are not requeued. Direct Agent invocations still require the local Agent to explicitly resume the original `invocation_id`; approval does not start a Core model loop.
|
|
37
|
+
|
|
38
|
+
Managed hosts continue fair calls to existing `tick()`. The first tick and subsequent minute-based maintenance advance pending settlement and approval continuation; standalone schedules these passes itself. No separate timer per Kernel is needed. Existing contracts continue to control pause, routing, tool permissions and final business authorization.
|
|
39
|
+
|
|
40
|
+
## Verify the upgrade
|
|
41
|
+
|
|
42
|
+
1. Check artifact identity, the target database's migration ledger and actual 065/066 structures. Verify `/health`, the console and existing business smoke checks.
|
|
43
|
+
2. Use read-only deployment diagnostics for public identity and readiness. Read the exit code together with the unchecked scope:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm run --silent doctor -- --deployment --url http://127.0.0.1:18900 --readiness --json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Default diagnostics only read health and version. `--readiness` asks the server to read its database and migration ledger. Diagnostics do not establish image digest or complete database identity, or perform upgrades; see [diagnostics](DEPLOYMENT_DIAGNOSTICS.en.md).
|
|
50
|
+
3. In a dedicated test environment, retain a meterable original pending request and stop incoming traffic. Verify settlement in its original ledger without another provider dispatch. Records lacking authoritative pricing or metering remain pending/unknown. Check the shared USD allowance and multiplier; result complete does not mean billing settled.
|
|
51
|
+
4. In a dedicated test environment, check a temporary audit or queue failure after approval. Retrying the original decision or waiting for maintenance should continue the original job. Lost queue acknowledgements, reopening or consumed approvals must not duplicate admission. Direct Agent calls still wait for explicit resume. Lost audit acknowledgements may produce repeated observations with the same `detail.continuation_id`, rather than another queue admission.
|
|
52
|
+
5. Confirm maintenance drains during shutdown. A timeout retains same-instance work and dependencies for later retry. Do not delete ledgers, clear markers or replace invocation IDs.
|
|
53
|
+
|
|
54
|
+
See [Core reliability](CORE_RELIABILITY.en.md#regression-entry-points-and-limits) for isolated regression commands and [model process recovery](MODEL_PROCESS_RECOVERY.en.md) for actual `SIGKILL` and lost COMMIT-acknowledgement acceptance. These tests use dedicated databases and synthetic providers. Skips are not passes, and regressions do not replace target-deployment or live-business acceptance.
|
|
55
|
+
|
|
56
|
+
## Rollback boundary
|
|
57
|
+
|
|
58
|
+
065/066 are additive migrations. A code rollback retains continuation tables, `approval_continuation_keys`, original requests and ledgers. Do not delete markers and resubmit approvals. Returning to 0.9.1 loses this release's automatic maintenance, persisted continuation and admission deduplication guarantees. Stop decision and job writes, then reconcile saved decisions, queue state, markers and in-flight work before assessing compatibility and rollback.
|
|
59
|
+
|
|
60
|
+
Restoring an older backup also requires accounting for requests, charges and external effects after that backup. Queue deduplication does not guarantee exactly-once external effects, and restoring a backup does not undo business actions. Business services retain idempotency and final authorization.
|
|
61
|
+
|
|
62
|
+
[Release notes](RELEASE_NOTES_v0.9.2.en.md) · [Reliability contract](CORE_RELIABILITY.en.md) · [Compatibility policy](COMPATIBILITY.en.md)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Core v0.9.2 补丁升级指南
|
|
2
|
+
|
|
3
|
+
[English](UPGRADE_v0.9.2.en.md)
|
|
4
|
+
|
|
5
|
+
从公开 Core 0.9.1 升级到 0.9.2,修复安装凭据、异步结算维护与审批补续,并取得只读部署诊断和进程恢复回归。MCP / Agent Client SDK 与 DSH 继续使用 0.7.0。升级仅涉及 Core;其他组件按各自项目核对和发布。
|
|
6
|
+
|
|
7
|
+
## 先保留数据,协调写入
|
|
8
|
+
|
|
9
|
+
备份目标数据库,保留配置与凭据、附件存储、原请求及审批记录、旧制品和宿主持久记录。停止新工作并协调所有共用状态库的写入方;核对原在途请求与已经保存的决策,再排空和关闭实例。保留原 `operation_id`、`invocation_id` 与审批 `decision_id`,不以新请求代替恢复。
|
|
10
|
+
|
|
11
|
+
0.9.1 的 usage 关闭等待继续有效。0.9.2 新增维护写账也纳入关闭等待;超时后在同一实例等待和重试,不据此强行关库或重新派发。
|
|
12
|
+
|
|
13
|
+
## 选择制品并显式迁移
|
|
14
|
+
|
|
15
|
+
使用正式 `v0.9.2` 源码、npm 包或镜像,核对版本、来源 Tag/提交与制品摘要。安装器和预构建镜像 Compose 默认版本同步为 0.9.2;已有 `.env` 不覆盖。新建配置需要可用的 OpenSSL,随机生成失败时先修复环境再重试。
|
|
16
|
+
|
|
17
|
+
通过官方迁移器应用全部未执行文件,源码安装入口为:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm run db:init
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
嵌入式宿主使用官方 `migrateBailingHubCoreSchema` 显式入口,并重新核对 `BAILINGHUB_CORE_ARTIFACT_V1` 完整制品 manifest。运行时启动不自动迁移。已记账的迁移由迁移器跳过,不手工改写历史 SQL 或迁移账本。
|
|
24
|
+
|
|
25
|
+
| 相对 0.9.1 新增迁移 | 作用 |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| `065_usage_reconciliation_scan.sql` | 添加 `(billing_state, updated_at, id)` 分页索引,不重算历史费用 |
|
|
28
|
+
| `066_approval_continuations.sql` | 添加补续表和 `bz_jobs.approval_continuation_keys`,保存原决策补续及持久入队标记,不回填历史决策 |
|
|
29
|
+
|
|
30
|
+
启用新审批入口前必须应用 066。补续事务写入失败会回滚决策,不能留下仅决策成功的孤立记录。更早版本还须应用全部缺少的前序迁移,模型计费升级另见 [0.9.0 指南](UPGRADE_v0.9.0.md)。
|
|
31
|
+
|
|
32
|
+
## 仓储和调用方配套
|
|
33
|
+
|
|
34
|
+
官方 MySQL/JSONL state 仓储与配置审批 ledger 一起升级。JSONL 的顺序写入仅支持一个 writer;不能用多个进程共同写同一文件。自定义配置仓储需提供 `decideWithContinuation`、`getContinuation`、`pendingContinuations`、`markContinuationAuditRecorded`、`completeContinuation`,自定义状态仓储需提供 `RuntimeStateStore.requeueApprovedJobOnce` 及配套原子语义。缺少支持时新决策返回 `approval_continuations_unavailable`,不回退旧入队路径。
|
|
35
|
+
|
|
36
|
+
外部审批同一决策重试使用原 `decision_id`;`503` 的 `decision_recorded=true / continuation_pending=true` 表示决策已保存,补续待恢复。控制台重试原审批单。历史决策没有新补续记录时不自动回填;已消费审批不重排。Agent 直调仍由本地 Agent 使用原 `invocation_id` 显式 resume,批准不启动 Core 模型循环。
|
|
37
|
+
|
|
38
|
+
managed 宿主继续公平调用既有 `tick()`,首个 tick 和后续每分钟维护推进待结算与审批补续;standalone 自行安排这些维护。无需为每个 Kernel 增加独立定时器。暂停、路由、工具权限与业务最终授权仍由原契约控制。
|
|
39
|
+
|
|
40
|
+
## 升级后如何确认
|
|
41
|
+
|
|
42
|
+
1. 核对新制品身份、目标库的迁移账本和 065/066 实际结构;检查 `/health`、控制台与既有业务 smoke。
|
|
43
|
+
2. 使用只读部署诊断核对公开身份和 readiness;退出码与未检查范围须一起读取:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm run --silent doctor -- --deployment --url http://127.0.0.1:18900 --readiness --json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
默认诊断只读取健康与版本;`--readiness` 会让服务端只读访问数据库及迁移账本。诊断不会确认镜像 digest、完整数据库身份或执行升级,详见[诊断文档](DEPLOYMENT_DIAGNOSTICS.md)。
|
|
50
|
+
3. 在专用测试环境保留一笔可计价的原 pending 请求,停止新流量,确认维护后原账本结算且没有第二次供应商派发;无法可靠计价的原记录仍为 pending/unknown。核对统一美元额度与倍率,不把结果 complete 等同于已 settled。
|
|
51
|
+
4. 在专用测试环境核对批准后审计或入队暂时失败,重试原决策或等待维护能继续原任务;入队确认丢失、重开或审批已消费后不会重复入队。Agent 直调仍等待显式续执行。审计确认丢失可产生同 `detail.continuation_id` 的重复观察,不等于第二次队列准入。
|
|
52
|
+
5. 停止时确认维护被排空。超时保留同实例的工作与依赖,等待后重试;不删账本、不清标记、不换调用 ID。
|
|
53
|
+
|
|
54
|
+
隔离回归命令见 [Core 可靠性修复](CORE_RELIABILITY.md#回归入口与限制);实际 `SIGKILL` 与 COMMIT 确认丢失专项见 [模型进程恢复](MODEL_PROCESS_RECOVERY.md)。这些用例使用专用测试库和合成供应商,跳过不计为通过,也不替代目标部署或真实业务验收。
|
|
55
|
+
|
|
56
|
+
## 回退边界
|
|
57
|
+
|
|
58
|
+
065/066 是增量结构。代码回退保留补续表、`approval_continuation_keys`、原请求与账本;不要删除标记后重投审批。回退到 0.9.1 会失去本版自动维护、持久补续与入队去重保证。先停止决策和任务写入,核对已保存决策、队列、标记及在途工作,再评估兼容性和回退。
|
|
59
|
+
|
|
60
|
+
恢复旧备份仍需核对备份之后的请求、扣费和外部业务效果。队列去重不保证外部业务恰好一次,备份恢复不撤销已经发生的业务动作。业务方继续维护幂等与最终权限。
|
|
61
|
+
|
|
62
|
+
[版本说明](RELEASE_NOTES_v0.9.2.md) · [可靠性契约](CORE_RELIABILITY.md) · [兼容策略](兼容性与升级.md)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Core v0.9.3 patch upgrade guide
|
|
2
|
+
|
|
3
|
+
[简体中文](UPGRADE_v0.9.3.md)
|
|
4
|
+
|
|
5
|
+
Upgrade public Core 0.9.2 to 0.9.3 for bounded bodies, graceful notification shutdown and executor-DLQ replay, plus read-only maintenance metrics. This guide concerns Core only. MCP / Agent Client SDK and DSH remain at 0.7.0; ACC, clients and independent Hosts release and deploy through their own procedures.
|
|
6
|
+
|
|
7
|
+
## Preserve data and coordinate writers
|
|
8
|
+
|
|
9
|
+
Back up the target database. Retain configuration and credentials, attachments, original jobs/requests, approvals, dead letters, queues and previous artifacts. Stop new work, coordinate all writers sharing the state database, and reconcile in-flight notifications and delivered/unknown receipts before draining old instances.
|
|
10
|
+
|
|
11
|
+
Retain original Job, request, operation, invocation, approval decision and DLQ IDs. The new shutdown guarantee requires new code; an old instance closing does not prove that untracked notifications finished. After a drain timeout, retain same-instance resources and retry later rather than forcing store closure or blindly resending unknown messages.
|
|
12
|
+
|
|
13
|
+
## Select artifacts and migrate explicitly
|
|
14
|
+
|
|
15
|
+
Use formal `v0.9.3` source, npm packages or images. Verify Tag/commit, version and artifact digest. Installer and prebuilt-image Compose defaults become 0.9.3; existing `.env` files are preserved and dependency versions remain unchanged.
|
|
16
|
+
|
|
17
|
+
Apply outstanding files through the official explicit migrator. Source installations use:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm run db:init
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Embedded integrations use official `migrateBailingHubCoreSchema` and verify the complete `BAILINGHUB_CORE_ARTIFACT_V1` artifact manifest. Startup does not migrate. Recorded SQL is skipped; do not manually edit historical SQL or migration records.
|
|
24
|
+
|
|
25
|
+
| Migration added since 0.9.2 | Purpose |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| `067_delivery_dlq_replay.sql` | Add `delivery_kind`, `notification_job_id` and `executor_replay_key` to `bz_delivery_dlq`, plus `delivery_replay_keys` to `bz_jobs` for original notification binding and permanent admission markers |
|
|
28
|
+
|
|
29
|
+
067 preserves old data without bulk-guessing historical DLQ kinds. Replay verifies original jobs; ambiguous bindings fail explicitly. Apply 067 before all new Core MySQL DLQ reads/writes, including native-channel record/get. Earlier upgrades also apply all missing preceding migrations; see the [0.9.2 guide](UPGRADE_v0.9.2.en.md) for 065/066 support.
|
|
30
|
+
|
|
31
|
+
## Match adapters and callers
|
|
32
|
+
|
|
33
|
+
Upgrade official MySQL/JSONL state adapters together with the DLQ ledger. Custom ledgers supply optional `ensureExecutorReplay`; state adapters supply `RuntimeStateStore.requeueDeliveryJobOnce`, with original-binding checks, atomic admission/marker writes and marker preservation under ordinary updates. Unsupported executor replay returns `delivery_dlq_replay_unavailable`, without redirecting to a same-named native channel. JSONL remains single-writer.
|
|
34
|
+
|
|
35
|
+
Replay retains full original notification-child input, recipient and request/job identities; do not rerun its business parent to deliver a message. `queued` means queue admission. Verify execution and recipient receipt separately. Permanent markers prevent the same DLQ from admitting twice. A later failure creates a new operational DLQ record. Native channels gain no exactly-once guarantee across systems; reconcile partial or unknown receipts.
|
|
36
|
+
|
|
37
|
+
Managed integrations retain existing `tick()` and `close(drainMs)` calls. Close waits for accepted notification work and dynamic children within its shared budget. Observe fixed-category failure/timeout metrics without treating counts as business or receipt evidence.
|
|
38
|
+
|
|
39
|
+
## Verify the upgrade
|
|
40
|
+
|
|
41
|
+
1. Check new artifact identity, the target migration ledger and actual 067 columns. Verify `/health`, the console and existing smoke checks. Optionally run explicit read-only diagnostics:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm run --silent doctor -- --deployment --url http://127.0.0.1:18900 --readiness --json
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This performs no migration and does not establish image digest or complete database identity. Read exit codes and unchecked scope; see [deployment diagnostics](DEPLOYMENT_DIAGNOSTICS.en.md).
|
|
48
|
+
2. In isolation, check within-budget and oversized tool bodies/attachments, including absent/understated lengths and multibyte text. Overflow after a dispatched write retains the original unknown outcome; recovery must not dispatch another business write.
|
|
49
|
+
3. Replay a failed executor-notification DLQ and verify only its original child is admitted. Concurrent retries and lost acknowledgements cannot duplicate admission or rerun the business parent. Real recipient receipt requires separate acceptance.
|
|
50
|
+
4. Verify delayed callbacks, delivery creation and DLQ writes block resource closure. A timeout preserves resources and permits same-instance retry. This does not test full notification recovery after SIGKILL.
|
|
51
|
+
5. If protected `/metrics` is enabled, inspect fixed-category in-flight work, failures, recent-run age, drain timeouts and last-page progress. Scraping starts no maintenance or provider request; process-local counts are not persisted backlog.
|
|
52
|
+
|
|
53
|
+
See [Core reliability](CORE_RELIABILITY.en.md#core-v093-http-and-notification-fixes) for synthetic tests and dedicated MySQL regressions. Skips are not passes. Release acceptance does not replace target-environment deployment acceptance.
|
|
54
|
+
|
|
55
|
+
## Rollback boundary
|
|
56
|
+
|
|
57
|
+
067 is additive. A code rollback preserves DLQ kind/binding/replay identity, `delivery_replay_keys`, queues, original records and migration history. Never delete markers and resubmit. Stop related writers and reconcile admitted/in-flight notifications and recipient evidence before deciding on rollback.
|
|
58
|
+
|
|
59
|
+
**Old versions do not automatically accept the newer migration ledger.** An older complete schema manifest or migrator may fail closed on unknown 067 history. Additive columns do not mean old readiness or migration paths must pass. Verify the intended older artifact against the retained new schema/ledger in an isolated copy and define recovery; deleting migration rows to bypass checks is not an acceptable shortcut. Old code also loses this release's body, graceful-close and replay-deduplication guarantees.
|
|
60
|
+
|
|
61
|
+
Restoring an older backup requires reconciling business effects, receipt and charges since the backup. A database restore does not undo those external effects. Do not blindly resend unknown deliveries; business services retain their own idempotency and final authorization.
|
|
62
|
+
|
|
63
|
+
[Release notes](RELEASE_NOTES_v0.9.3.en.md) · [Reliability contract](CORE_RELIABILITY.en.md) · [Compatibility policy](COMPATIBILITY.en.md)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Core v0.9.3 补丁升级指南
|
|
2
|
+
|
|
3
|
+
[English](UPGRADE_v0.9.3.en.md)
|
|
4
|
+
|
|
5
|
+
从公开 Core 0.9.2 升级到 0.9.3,修复有限收包、通知正常关闭与执行器死信重投,增加只读维护指标。本指南只涉及 Core;MCP / Agent Client SDK、DSH 仍为 0.7.0,ACC、客户端与独立 Host 按各自流程发行和部署。
|
|
6
|
+
|
|
7
|
+
## 保留数据并协调写入
|
|
8
|
+
|
|
9
|
+
备份目标数据库,保留配置与凭据、附件、原任务/请求、审批、死信、队列及旧制品。停止新工作并协调所有共用状态库的写入方,核对在途通知和已送达/未知送达记录,再排空关闭旧实例。
|
|
10
|
+
|
|
11
|
+
保留原 Job、request、operation、invocation、审批 decision 和死信 ID。新关闭保证需新代码参与;旧实例的关闭成功不证明尚未登记的通知已完成。关闭超时后保留同实例资源,等待后重试,不强制关库或盲目重发未知消息。
|
|
12
|
+
|
|
13
|
+
## 选择制品并显式迁移
|
|
14
|
+
|
|
15
|
+
选择正式 `v0.9.3` 源码、npm 包或镜像,核对 Tag/提交、版本和制品摘要。安装器、预构建镜像 Compose 默认版本同步为 0.9.3;已有 `.env` 保留,依赖版本不更新。
|
|
16
|
+
|
|
17
|
+
通过官方显式迁移器应用全部未执行文件。源码入口:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm run db:init
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
嵌入式使用官方 `migrateBailingHubCoreSchema` 显式入口;核对完整 `BAILINGHUB_CORE_ARTIFACT_V1` 制品 manifest。启动不自动迁移,已记账 SQL 跳过,不手工编辑历史 SQL 或迁移账本。
|
|
24
|
+
|
|
25
|
+
| 相对 0.9.2 新增迁移 | 作用 |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| `067_delivery_dlq_replay.sql` | 在 `bz_delivery_dlq` 增加 `delivery_kind`、`notification_job_id`、`executor_replay_key`;在 `bz_jobs` 增加 `delivery_replay_keys`,保存通知原记录与永久入队标记 |
|
|
28
|
+
|
|
29
|
+
067 不清除旧数据,不批量猜测历史死信类型。旧死信重投时由 Core 核对原任务;绑定不明时明确拒绝。启动新 Core 的全部 MySQL DLQ 读写前必须应用 067,包括原生渠道 record/get;从更早版本升级还须补全部前序迁移,065/066 配套见 [0.9.2 指南](UPGRADE_v0.9.2.md)。
|
|
30
|
+
|
|
31
|
+
## 配套仓储与调用方
|
|
32
|
+
|
|
33
|
+
官方 MySQL/JSONL 状态仓储及 DLQ ledger 一起升级。自定义 ledger 提供可选 `ensureExecutorReplay`,自定义状态仓提供 `RuntimeStateStore.requeueDeliveryJobOnce`,并保证核对原绑定、原子入队和标记、标记不被普通更新清除。未配套时执行器重投返回 `delivery_dlq_replay_unavailable`,不改发同名原生渠道。JSONL 仍仅支持单 writer。
|
|
34
|
+
|
|
35
|
+
重投保留原通知子任务的完整输入、收件人和 request/job 标识;不使用业务父任务重跑来补发。返回 `queued` 是队列准入,实际送达另看执行状态/收件方证据。同一死信的永久标记阻止重复入队;再次失败形成的新死信属于新的运营处理记录。原生渠道不新增跨系统恰好一次保证,部分或未知送达仍需核对。
|
|
36
|
+
|
|
37
|
+
保持 managed 的既有 `tick()` 与 `close(drainMs)`;关闭按共同预算等待已接受通知及动态子工作。通知失败和超时应观察固定类别指标,不能用计数代替业务或接收方证据。
|
|
38
|
+
|
|
39
|
+
## 升级验收
|
|
40
|
+
|
|
41
|
+
1. 核对新制品身份、目标库迁移账本与 067 实际字段,检查 `/health`、控制台和既有 smoke。可显式运行只读诊断:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm run --silent doctor -- --deployment --url http://127.0.0.1:18900 --readiness --json
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
它不执行迁移或确认镜像摘要、完整数据库身份。读取退出码及未检查范围,见[部署诊断](DEPLOYMENT_DIAGNOSTICS.md)。
|
|
48
|
+
2. 在隔离环境检查限额内/超限工具正文与附件,包含缺少/低报长度和多字节文本。已外发写操作超限后保留原调用未知结果,恢复不得出现第二次业务派发。
|
|
49
|
+
3. 核对执行器通知失败产生的死信:一次重投仅将原通知子任务入队;并发/确认丢失重试不重复入队,也不重跑业务父任务。实际收件方送达另行验收。
|
|
50
|
+
4. 核对延迟回调、通知派生和 DLQ 写入阻挡资源关闭,排空超时保留资源且同实例重试成功。这不验证 SIGKILL 后全量通知补投。
|
|
51
|
+
5. 若启用受保护的 `/metrics`,检查固定类别的后台在途、失败、运行年龄、排空超时和最近一页进度。抓取不触发维护或供应商请求;进程计数不是持久积压量。
|
|
52
|
+
|
|
53
|
+
合成测试及专用 MySQL 回归入口见 [Core 可靠性](CORE_RELIABILITY.md#core-v093-的-http-与通知修复)。跳过不计通过,发行验收不代替目标环境的部署验收。
|
|
54
|
+
|
|
55
|
+
## 回退边界
|
|
56
|
+
|
|
57
|
+
067 是增量结构;代码回退保留死信类型/绑定/重投标识、`delivery_replay_keys`、队列、原记录及迁移账本,不能删除标记后重投。先停止相关写入,核对已准入和在途通知、收件方证据,再决定回退。
|
|
58
|
+
|
|
59
|
+
**旧版本不自动兼容新迁移账本。** 旧制品的完整 schema manifest 或迁移器可能因未知的 067 记录失败关闭;字段增量不等于旧 readiness/迁移入口必然通过。必须在隔离副本验证目标旧制品与保留的新 schema/账本组合,明确恢复方式,不能靠删除迁移记录绕过检查。回退旧代码也会失去本版收包、通知关闭及重投去重保证。
|
|
60
|
+
|
|
61
|
+
若恢复旧备份,核对备份后已经发生的业务、消息送达和账务;数据库恢复不撤销这些外部效果。未知送达不能盲目补发,业务方保留自己的幂等与最终授权。
|
|
62
|
+
|
|
63
|
+
[版本说明](RELEASE_NOTES_v0.9.3.md) · [可靠性契约](CORE_RELIABILITY.md) · [兼容策略](兼容性与升级.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bailinghub",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Open-source ACC runtime and agent control plane for existing business systems.",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"executor": "tsx src/executor.ts",
|
|
56
56
|
"executor:watch": "tsx watch src/executor.ts",
|
|
57
57
|
"typecheck": "tsc --noEmit",
|
|
58
|
+
"installer:secrets:test": "node --test scripts/install-secrets.test.mjs",
|
|
58
59
|
"test": "node --import tsx --test \"src/**/*.test.ts\"",
|
|
59
60
|
"db:init": "tsx scripts/init-db.ts",
|
|
60
61
|
"demo:seed": "tsx scripts/seed-demo.ts",
|
|
@@ -90,7 +91,7 @@
|
|
|
90
91
|
"release:consistency:test": "node --test scripts/check-release-consistency.test.mjs",
|
|
91
92
|
"release:audit": "npm run release:consistency && npm run release:consistency:test && npm run images:policy:test && npm run public-content:denylist:test && npm run security:scan && npm run oss:guard && node scripts/release-audit.mjs && npm run package:artifact:check",
|
|
92
93
|
"github:verify": "node scripts/verify-github-repo.mjs",
|
|
93
|
-
"release:check": "npm run notices:check && npm run assets:check && npm run audit:deps && npm run client-api:contract && npm run client-api:ecosystem:clone && npm run typecheck && npm test && npm run widget:renderer:test && npm run web-admin:check && npm run docs:check && npm run examples:check && npm run sdk:test && npm run sdk:test7 && npm run sdk:test-node && npm run sdk:test-python && npm run sdk:test-runtime && npm run sdk:test-p1 && npm run release:audit && npm run oss:verify && npm run github:verify",
|
|
94
|
+
"release:check": "npm run notices:check && npm run assets:check && npm run audit:deps && npm run client-api:contract && npm run client-api:ecosystem:clone && npm run typecheck && npm run installer:secrets:test && npm run doctor:deployment:typecheck && npm run doctor:deployment:test && npm test && npm run widget:renderer:test && npm run web-admin:check && npm run docs:check && npm run examples:check && npm run sdk:test && npm run sdk:test7 && npm run sdk:test-node && npm run sdk:test-python && npm run sdk:test-runtime && npm run sdk:test-p1 && npm run release:audit && npm run oss:verify && npm run github:verify",
|
|
94
95
|
"images:build": "sh scripts/publish-images.sh",
|
|
95
96
|
"images:publish": "BAILING_PUSH_IMAGES=1 sh scripts/publish-images.sh",
|
|
96
97
|
"images:publish-mysql": "BAILING_PUSH_IMAGES=1 sh scripts/publish-mysql-image.sh",
|
|
@@ -105,7 +106,10 @@
|
|
|
105
106
|
"sdk:test-p1": "node scripts/sdk-p1-check.mjs",
|
|
106
107
|
"sdk:pack": "COPYFILE_DISABLE=1 tar --no-xattrs -czf web/connect/bailing-connect-php.tgz -s '|^php|bailing-connect-php|' -C sdk php",
|
|
107
108
|
"sdk:pack7": "COPYFILE_DISABLE=1 tar --no-xattrs -czf web/connect/bailing-connect-php7.tgz -s '|^php7|bailing-connect-php7|' -C sdk php7",
|
|
108
|
-
"audit:deps:test": "node --test scripts/dependency-audit.test.mjs"
|
|
109
|
+
"audit:deps:test": "node --test scripts/dependency-audit.test.mjs",
|
|
110
|
+
"doctor:deployment:test": "node --import tsx --test scripts/doctor-deployment.test.ts",
|
|
111
|
+
"doctor:deployment:typecheck": "tsc --noEmit --strict --skipLibCheck --target ES2022 --module ESNext --moduleResolution Bundler --lib ES2022 --types node scripts/doctor.ts scripts/doctor-deployment.ts scripts/doctor-deployment.test.ts",
|
|
112
|
+
"test:model-process-recovery": "node --import tsx --test src/app/kernel-model-process-crash.mysql.test.ts"
|
|
109
113
|
},
|
|
110
114
|
"dependencies": {
|
|
111
115
|
"mammoth": "^1.12.0",
|
|
@@ -107,6 +107,10 @@ const englishCompanions = {
|
|
|
107
107
|
'docs/RELEASE_NOTES_v0.9.0.md': 'docs/RELEASE_NOTES_v0.9.0.en.md',
|
|
108
108
|
'docs/UPGRADE_v0.9.0.md': 'docs/UPGRADE_v0.9.0.en.md',
|
|
109
109
|
'docs/RELEASE_NOTES_v0.9.1.md': 'docs/RELEASE_NOTES_v0.9.1.en.md',
|
|
110
|
+
'docs/RELEASE_NOTES_v0.9.2.md': 'docs/RELEASE_NOTES_v0.9.2.en.md',
|
|
111
|
+
'docs/UPGRADE_v0.9.2.md': 'docs/UPGRADE_v0.9.2.en.md',
|
|
112
|
+
'docs/RELEASE_NOTES_v0.9.3.md': 'docs/RELEASE_NOTES_v0.9.3.en.md',
|
|
113
|
+
'docs/UPGRADE_v0.9.3.md': 'docs/UPGRADE_v0.9.3.en.md',
|
|
110
114
|
'docs/UPGRADE_v0.9.1.md': 'docs/UPGRADE_v0.9.1.en.md',
|
|
111
115
|
'docs/MODEL_BILLING.md': 'docs/MODEL_BILLING.en.md',
|
|
112
116
|
'docs/PERIOD_ALLOWANCE_UPGRADE.md': 'docs/PERIOD_ALLOWANCE_UPGRADE.en.md',
|
|
@@ -9,7 +9,7 @@ REGISTRY="${BAILING_IMAGE_REGISTRY:-$DEFAULT_REGISTRY}"
|
|
|
9
9
|
NAMESPACE="${BAILING_IMAGE_NAMESPACE:-$DEFAULT_NAMESPACE}"
|
|
10
10
|
PACKAGE_VERSION="$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' package.json | head -1)"
|
|
11
11
|
TAG="${BAILING_IMAGE_TAG:-$PACKAGE_VERSION}"
|
|
12
|
-
[ -n "$TAG" ] || TAG="0.9.
|
|
12
|
+
[ -n "$TAG" ] || TAG="0.9.3"
|
|
13
13
|
MYSQL_TAG="${BAILING_MYSQL_IMAGE_TAG:-8.4}"
|
|
14
14
|
MYSQL_IMAGE="${BAILING_MYSQL_IMAGE:-$REGISTRY/$NAMESPACE/bailing-mysql:$MYSQL_TAG}"
|
|
15
15
|
PLATFORM="${BAILING_IMAGE_PLATFORM:-linux/amd64}"
|
|
@@ -38,8 +38,8 @@ function updateJson(root, relativePath, update) {
|
|
|
38
38
|
test('current release surface is internally consistent', () => {
|
|
39
39
|
const result = checkReleaseConsistency({ root: repoRoot });
|
|
40
40
|
assert.deepEqual(result.findings, []);
|
|
41
|
-
assert.equal(result.version, '0.9.
|
|
42
|
-
assert.equal(result.stableVersion, '0.9.
|
|
41
|
+
assert.equal(result.version, '0.9.3');
|
|
42
|
+
assert.equal(result.stableVersion, '0.9.3');
|
|
43
43
|
assert.equal(result.publishTag, 'latest');
|
|
44
44
|
});
|
|
45
45
|
|