fix: stabilize API routing and simplify delivery reports
This commit is contained in:
@@ -17,6 +17,8 @@ Expected:
|
||||
- original demand 10 remains visible and each model is queried exactly once with quantity 10; stock accounting is handled by the API, with no local inventory deduction, yield adjustment or batch rounding;
|
||||
- the bot immediately adds the Feishu `OnIt` (typing) reaction to the original message after the valid trigger is accepted and before the API query starts;
|
||||
- the controlled script uses the macOS system trust store and keeps TLS verification enabled;
|
||||
- the controlled script defaults to a direct HTTPS connection to `api.zeroerr-agent.com`, ignoring system/environment proxies for this API only; it does not change Feishu or other applications' proxy settings;
|
||||
- an explicit `ZEROERR_AGENT_PROXY_MODE=system` uses the configured proxies; an invalid mode or a non-approved direct target stops before the request, and a failed request does not trigger an automatic proxy fallback or retry;
|
||||
- no temporary TLS-bypass parameter is required for the normal happy path;
|
||||
- API script runs;
|
||||
- output does not expose API key;
|
||||
@@ -25,6 +27,7 @@ Expected:
|
||||
- output omits the `候选明细` heading and does not repeat a human-review line under each candidate;
|
||||
- model differences use the compact `字段 原值→新值` format and join multiple changes with `;`;
|
||||
- Feishu output uses rich-text `post`; the report title, overall-judgment heading, numbered candidate headings, and unavailable-candidate heading are bold;
|
||||
- in initial and continuation replies, the `X个工作日` and final delivery date values are bold in both `最快候选交期` and each model's `AM516预测交期`, using native Feishu rich-text styles without displaying Markdown asterisks;
|
||||
- the judgment level and fixed disclaimer provide the global human-review boundary;
|
||||
- inventory output is limited to summary-level available quantity and coverage; non-reducer shortage output never exposes material codes or raw ERP details;
|
||||
- each usable model includes `缺料物料明细` listing only shortage names, preserving order and deduplicating names; use the API's `物料名称` / `缺料物料名称` first, then resolve `缺料物料` through `data/material_names.json`; the same behavior applies to continuation replies;
|
||||
@@ -244,7 +247,7 @@ python3 capabilities/am516-delivery-prediction/scripts/delivery_prediction_query
|
||||
Expected:
|
||||
|
||||
- the script creates an unverified SSL context only because the flag is explicitly present;
|
||||
- the context is passed to the single controlled `urlopen` call;
|
||||
- the context is passed to the request-local HTTPS handler used by the single controlled `opener.open` call;
|
||||
- the result does not expose the API Key;
|
||||
- a successful response remains an internal candidate and requires human review;
|
||||
- the temporary result does not remove the long-term certificate-repair requirement.
|
||||
@@ -275,5 +278,5 @@ Expected:
|
||||
- D=8/S=5: send 8; D=24/S=6: send 24; D=24/S=0: send 24; D=24/S>=24: still send 24 once and preserve the API response.
|
||||
- Different candidates display their own stock, but all use unchanged original demand. Initial and continuation batches query each current-batch model once.
|
||||
- Missing/invalid stock is unknown, never zero; valid API workdays/date remain usable with an explicit inventory-review item. Missing/invalid workdays/date or failed requests retain existing error handling.
|
||||
- New report and record metadata contain actual API quantities, with no local net-demand or production-quantity fields. Historical records and existing candidate-table columns remain unchanged.
|
||||
- Initial and continuation Feishu reports show demand quantity, lead time and inventory coverage, but omit `数量传递规则`, `库存覆盖口径` and per-model `API查询数量`. Internal record metadata still contains actual API quantities and quantity rules. No local net-demand or production-quantity fields are shown. Historical records and existing candidate-table columns remain unchanged.
|
||||
- These checks use mocked responses locally. Runtime acceptance must verify actual API arguments and compare the displayed workdays/date with the same returned response; mocked dates do not constitute delivery predictions.
|
||||
|
||||
@@ -25,7 +25,7 @@ API quantity = D
|
||||
|
||||
库存缺失或无效时显示待复核,不视作 0;如果 API 已返回有效工作日交期和最终交货日期,机器人保留该交期并标明库存覆盖无法判断。缺失有效交期字段或请求失败时继续执行原有异常处理。
|
||||
|
||||
报告展示需求数量、API 查询数量、API 返回交期和库存覆盖情况,不再输出本地净需求或排产测算数量。新记录保存原始需求及每个型号实际 API 查询数量,历史记录不改写。
|
||||
飞书报告展示需求数量、API 返回交期和库存覆盖情况。按 AR51 于 2026-10-16 的显示要求,首次及续查回复均不显示“数量传递规则”“库存覆盖口径”和各型号下的“API查询数量”,也不输出本地净需求或排产测算数量。内部记录仍保存数量规则、原始需求及每个型号实际 API 查询数量,历史记录不改写。
|
||||
|
||||
## 已取消的旧逻辑
|
||||
|
||||
|
||||
@@ -39,6 +39,28 @@ python3 capabilities/am516-delivery-prediction/scripts/delivery_prediction_query
|
||||
|
||||
Do not run this check until AR51 confirms the functional test and creates a separate trusted approval record explicitly covering `api.zeroerr-agent.com`, the AM516 use case, and API-key use.
|
||||
|
||||
## API Network Route
|
||||
|
||||
The controlled query script defaults to `ZEROERR_AGENT_PROXY_MODE=direct` for
|
||||
`https://api.zeroerr-agent.com`. It uses a request-local opener with an empty
|
||||
proxy map, so this API does not inherit macOS or environment proxy settings.
|
||||
Feishu, Codex and other applications retain their existing network settings.
|
||||
The bridge launches the script for each query, so script updates take effect on
|
||||
the next query without restarting the bridge or clearing continuation context.
|
||||
|
||||
On 2026-10-16, the proxy log for the 08:51 failed query showed a default-proxy
|
||||
connection timeout to this API. AR51-approved comparison queries with the fixed
|
||||
sample both succeeded later: system proxy 20.04 seconds, direct 4.79 seconds.
|
||||
These are individual observations, not an availability or latency guarantee.
|
||||
|
||||
If another approved runtime requires a company proxy, configure
|
||||
`ZEROERR_AGENT_PROXY_MODE=system` in that runtime's environment (or the bridge's
|
||||
local `.env`, followed by a bridge restart). This selects the configured proxy
|
||||
route explicitly. It does not authorize a new destination. Invalid modes and
|
||||
direct requests outside the approved HTTPS hostname stop before the request.
|
||||
There is no automatic proxy fallback or extra API retry, and TLS certificate
|
||||
verification remains enabled.
|
||||
|
||||
## Normal TLS Trust Configuration
|
||||
|
||||
The controlled query script injects `truststore` before making the request. Normal queries therefore keep TLS certificate verification enabled while using the macOS system trust store, including an AR51-approved company proxy root certificate installed and trusted in the system keychain.
|
||||
|
||||
Reference in New Issue
Block a user