Skip to content

track: fail the run when the upstream suite or container smoke did not pass - #3400

Open
Birfy wants to merge 2 commits into
mainfrom
dev/3399-track-failure-visible
Open

Birfy wants to merge 2 commits into
mainfrom
dev/3399-track-failure-visible

Conversation

@Birfy

@Birfy Birfy commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Related #3399

ds-bot-upstream-track.yml 的 suite 与 smoke 两步带 continue-on-error: true,所以整次 run 的结论永远是绿的:套件或容器启动挂了,只有点进它开出来的 PR 正文才知道。这个 PR 把失败搬到 run 结论上,同时不动原有行为。

改了什么(单文件 1 file changed, 34 insertions(+), 1 deletion(-) vs main 34a80ca5a1)

  • 顶部注释补一句:失败仍开 draft PR,但 run 会在最后一步变红
  • 末尾新增一步 Fail the run when either check did not pass,if: always() && steps.target.outputs.skip == 'false',按 steps.suite.outcome / steps.smoke.outcome 分三档:
    • success → 什么都不做
    • skipped → 打一行普通说明(skipped 只在前序步骤已失败时出现,此时 run 已经红了),不加注解、不计入失败
    • failure / cancelled / 空值 → ::error:: 点名是哪一项、附 run 链接,并让本步非 0 退出
    • 只有两项都 success 才打印「both passed」(守卫不用 failed == 0,否则两项都 skipped 时会误报通过)
  • :80 / :98 的 continue-on-error 与 :140 的 draft=(--draft) 一个字节没动;tests.yml、runtime/** 零改动

为什么不动 draft 行为

套件挂了的时候,分支、PR 和日志本身就是诊断材料;去掉 continue-on-error 会让 PR 步骤根本不跑,反而丢掉这些。所以保留:PR 照开、照标 draft,让「失败了」这件事同时出现在 check 上。

验证到哪一步(本地绿,不是 CI 绿)

  • YAML YAML.parse → steps = 8,末步名与 if 如上;6 个 run: 块逐个 bash -n 全 OK
  • 干跑矩阵(在远端字节上跑,非工作副本):success/success → both passed, exit 0;failure/success、success/failure、cancelled/success、skipped/failure、空值/cancelled → 对应 ::error::, exit 1;skipped/skipped → 两行说明、无注解、exit 0
  • node scripts/ds-bot-upstream.mjs check → ok(12 paths)
  • 没有任何 CI 证据:这步的真实效果要一次真 run 才算验过,它要求 docker build 加 upstream npm ci,本机触发不了。合并后第一次 daily run(或手动 dispatch)才是它的第一次真检验。

风险

按 .github/agent/risk-rules.json(#3394)判 T3(path .github/workflows/ds-bot-upstream-track.yml),需人工批准后才谈合并。未验收通过。

The upstream suite and the container smoke keep their continue-on-error, so the
run's conclusion stayed green when either of them failed; only the pull request
body carried the outcome. A last step now repeats each non-success outcome,
emits ::error:: for it and exits 1, so a green run means both checks passed.

An already-pinned day (steps.target.outputs.skip == 'true') still ends green:
the step only runs when there was something to sync. The draft pull request
behaviour is unchanged.

Related #3399
`skipped` for the suite or the smoke step only happens when an earlier step
already failed, so it now prints one plain line instead of an annotation and
does not count towards the exit code; `failure`, `cancelled` and empty still
annotate and fail. The success line is now guarded on both outcomes actually
being success, so two skips cannot read as "both passed". The both-skipped,
all-green path is unreachable: the step only runs when `skip == false`.
@Birfy Birfy added agent-pr Pull request opened by an agent risk:T3 Risk tier T3 (needs a human approval), set by the controller from the diff labels Nov 26, 2026
@Birfy

Birfy commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Risk label provenance — script output at head 59a1eb15aed556e283732757ff3f4271a5d9487d.

Command: node .github/scripts/risk-gate.mjs --pr 3400, run in /data/workspace/.risk-ci/remote-head, where engine and rules are byte-identical to #3394 head bdf1a871a1 (risk-gate.mjs 26f8f72c, risk-tier.mjs 8766c30d, .github/agent/risk-rules.json b5e3fac8). stdout verbatim:

risk-gate (report only): PR #3400 tier T3; path .github/workflows/ds-bot-upstream-track.yml

### Risk tier: T3

high risk: the automation itself, the vendored upstream, dependency and deploy manifests, secrets and auth code. Green CI is not enough; a human approves.

Size (generated files excluded): 32 changed lines in 1 files.

Why:
- path .github/workflows/ds-bot-upstream-track.yml

_Report only: this does not block, label or merge anything. Rules: `.github/agent/risk-rules.json` (issue #3393)._

risk-tier: T3; basis: .github/workflows/ds-bot-upstream-track.yml=T3

exit 0. The risk:T3 label on this PR comes from that output, not from a hand decision.

Consequence, stated plainly: this PR must not be merged until a human approves the T3 tier. That approval is what this pilot exists to exercise — the run is green-by-design is exactly the defect being fixed, so nobody should read a green check suite here as permission to merge.

未验收通过。

@Birfy

Birfy commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

QA 证据(exact head)· 1/2

Head 59a1eb15aed556e283732757ff3f4271a5d9487d · 分支 dev/3399-track-failure-visible · PR #3400 · base main 34a80ca5a1acf9d7da821664002fa1e9dba2b215
出证时间 2026-11-26T09:40:35Z · 状态:本地 干跑通过 | CI 16/16 全绿(截至同一时刻)
本证据只对上面这个 40 位 head 有效。分支再推任何提交,本证据立即作废,需按新 head 重出。

1. 绑定:我测的字节就是这个 head(不是作者的工作副本)

$ curl -s https://api.github.com/repos/ThinkFlowLab/FlyBot/pulls/3400 | jq -r .head.sha
59a1eb15aed556e283732757ff3f4271a5d9487d
$ curl -sSLo head.tar.gz https://codeload.github.com/ThinkFlowLab/FlyBot/tar.gz/refs/pull/3400/head
$ mkdir head && tar xzf head.tar.gz -C head --strip-components=1 && cd head
$ git init -q . && git add -A -f . && git write-tree
bc38d8079de3a815c32a3699d30fa5a2e3ef6f0d
$ git hash-object .github/workflows/ds-bot-upstream-track.yml
7c83447e44d4e6cfe4e5c65b02ebfb7305b8b3ae
$ sha256sum .github/workflows/tests.yml
6f60af36d734e48933f585e05857c2878f6673430065742568603fdea57fe2a9

bc38d807… 等于 /commits/59a1eb15… 的 commit.tree.sha → 整棵树一致,不是抽样;blob 7c83447e 与作者本地 git hash-object 一致(此前那次整文件重发漂移没有残留)。文件 9438 B / 173 行,末字节 0a,零 CR。

改动面:1 文件 +31 / −1,只有 .github/workflows/ds-bot-upstream-track.yml;tests.yml 在 diff 里 0 项、与 main sha256 相同;vendor runtime/ds-bot-upstream/** 0 文件。对比口径 compare/34a80ca5a1...59a1eb15:ahead 2, behind 0, files 1。

2. 本地结果(数字来自本机,不是 CI)

命令 结果
YAML 解析(yaml 模块,解析 head 内的文件) 语法有效;on = schedule,workflow_dispatch;jobs = track;steps = 8;末步名 Fail the run when either check did not pass;末步 if = always() && steps.target.outputs.skip == 'false'
6 个 run: 块逐个 bash -n 6/6 rc=0(clean,无 stderr)
末步干跑矩阵(直接 bash 跑 head 里那段脚本) 8 组见下
grep -n continue-on-error :80、:98 两处仍在(未动面)
grep -n 'draft=' :139 draft=()、:140 if [ "$SUITE" != success ] || [ "$SMOKE" != success ]; then draft=(--draft); fi 仍在
pipefail 行为验证 set -euo pipefail; ( exit 3 ) 2>&1 | tee /dev/null → rc=3,tee 不会吞掉失败
SUITE=success  SMOKE=success  -> exit 0  "Upstream suite and container startup smoke both passed on v9.9.9."
SUITE=failure  SMOKE=success  -> exit 1  ::error::... Upstream suite did not pass (outcome: failure)
SUITE=success  SMOKE=failure  -> exit 1  ::error::... Container startup smoke did not pass (outcome: failure)
SUITE=cancelled SMOKE=success -> exit 1  ::error::... (outcome: cancelled)
SUITE=skipped  SMOKE=failure  -> exit 1  一行 skipped 说明 + ::error::... smoke (outcome: failure)
SUITE=''       SMOKE=cancelled-> exit 1  ::error::... (outcome: empty) + ::error::... (outcome: cancelled)
SUITE=skipped  SMOKE=skipped  -> exit 0  两行 skipped 说明,**且没有** "both passed" 那句
SUITE=failure  SMOKE=failure  -> exit 1  两条 ::error::

另外验了一个边界:env -u SUITE(真未定义,非空串)→ set -u 直接 unbound variable、exit 1。方向是安全的(不会变绿),且 Actions 里该 env 恒有定义(步骤没跑时是空串,走 empty 分支)。

@Birfy

Birfy commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

QA 证据(exact head)· 2/2

接上条。同样只对 head 59a1eb15aed556e283732757ff3f4271a5d9487d 有效。

3. CI 结果(拉的是 /commits/59a1eb15…/check-runs)

全部 16 个 check 来自同一个 run:45793404765(FlyBot CI / tests.yml / 事件 pull_request)。

check 结论 job
FlyBot required checks completed success 139820255446
upstream / Upstream suite · Node 22 · DSH from pin completed success 139817948327
upstream / Upstream suite · Node 24 · DSH from pin completed success 139817948306
upstream / Container startup smoke completed success 139817948265
upstream / Pin and vendor tree completed success 139817838665
Management API · Python 3.11 / 3.13 completed success ×2 139817838128 / 139817838423
provenance / provenance、flybot-social-plugin-tests、bot-social-source-tests completed success ×3 同上 run
social-host / Social plugin…、Façade and ledger unit tests completed success ×2 同上 run
runtime-image / Image recipe…、Build and smoke under the manager contract completed success ×2 同上 run
browser / screenshots、Web and compose planner completed success ×2 同上 run

合计 16 个 check:16 success / 0 未跑完 / 0 不存在;FlyBot required checks 已存在。

中途读数留档:约 09:39Z 同一命令拉到 15 个 —— 13 success / 2 in_progress(upstream / Upstream suite · Node 22、provenance / bot-social-source-tests),汇总门 absent;09:40:35Z 才 16/16。两句话不能合成「一直绿」。

这次改动本身没有被 CI 执行过,这是本证据最重要的一条:

  • ds-bot-upstream-track.yml(workflow id 429757680)/actions/workflows/ds-bot-upstream-track.yml/runs → total_count 0:它历史上从未跑过一次(只在 schedule/workflow_dispatch 上触发)。
  • 该 head 上 /actions/runs?head_sha=59a1eb15… → 只有 1 个 workflow:FlyBot CI(tests.yml,pull_request)。新增的末步不在任何人执行过的清单里。
  • 上面 upstream / 那几个绿勾来自 ds-bot-upstream.yml(由 tests.yml:57 复用调用),不是 track 工作流。而且它跑的不是同一套命令:ds-bot-upstream.yml:84 是 NODE_OPTIONS="…--import=…/upstream-test-clock.mjs" npm test -- --test-concurrency=1,track.yml:92 是裸 npm test 2>&1 | tee;ds-bot-upstream.yml:79 还多跑一条 node --test runtime/flybot-image/test/native-open-parts.test.mjs,track 里没有对应步骤;smoke 侧 :111/:113 用 -t …:test,track.yml:107/108 用 :track 且把输出 tee 到文件。所以「现场依赖的 npm ci / harness / build-client / lint / docker smoke 在这个 head 上能跑通」成立,「track 的 suite 步骤已验证」不成立。

4. 没做到 / 没覆盖到的

  • 新增末步从未在真实 Actions 里执行过;我只能证明脚本在 SUITE/SMOKE 注入下行为正确,不能证明 steps.<id>.outcome 在 Actions 里的真实取值、always() 在 job 被取消时的行为、以及 ::error:: 注解在运行页上的渲染。
  • 我没有跑 npm ci / docker build / 上游全量 suite(需要网络与 docker,且本 PR 未改 vendor);node scripts/ds-bot-upstream.mjs check 我也没重跑(diff 里 vendor 0 文件,与本切片无关)。
  • 「skip == 'true'(已 pin / 分支已存在)」这条路径上末步根本不跑,run 可以是绿的 —— 这是设计,但意味着绿不等于两项检查跑过;该路径我按 YAML 读到,未实跑。
  • skipped/skipped 的 exit 0 依赖「前一步已经红」这个前提;若将来有人把 Sync 的失败也涂成绿,这一步会静默放行。本次 dry run 只证行为,不证这个前提。
  • PR 标签 risk:T3 是脚本打的(agent-pr,risk:T3,PR mergeable: true / mergeable_state: clean),但判级过程不在我这次核对的范围内;T3 人工批准仍未完成。
  • 我只核了 head 与 main 的差,没有评审「三档语义是否就是想要的口径」(例如 skipped 该不该单独成红)——那是评审判断。

5. 本证据不构成验收通过

这是我核到的「这个 head 上发生了什么」,不是「这个 PR 可以合并」:没有做产品验收,没有做 T3 人工批准,没有声明与 0.3.0 parity。16 个绿勾没有一个执行过本次改动的那一步,别把绿色当成它被验过了。是否合并、是否验收由 Lead 判。合并后若 rebase 或补提交,本证据作废。

Related #3399

@Birfy

Birfy commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Lead 评审记录

Head 59a1eb15aed556e283732757ff3f4271a5d9487d · base main 34a80ca5a1acf9d7da821664002fa1e9dba2b215 · 分支 dev/3399-track-failure-visible · Related #3399

1. 切片边界(一个 PR 一个可评审切片)

改一个文件一件事:.github/workflows/ds-bot-upstream-track.yml +31/−1,在这个工作流末尾加一步 Fail the run when either check did not pass,让「suite / smoke 任一没通过」体现在整次 run 的结论上。continue-on-error(:80/:98)与 draft=(--draft)(:140)故意保留:前者让两项检查都跑完再判、后者让 PR 以草稿开出来,两者都不是涂绿 —— 读的是 steps.suite.outcome / steps.smoke.outcome,不是 conclusion。真正的缺口只是「run 结论永远绿」,本 PR 只补这一处。

tests.yml 零改动、required check 名零改动、vendor runtime/ds-bot-upstream/** 零改动(git hash-object 与 commit.tree.sha 全等,不是抽样)。

2. 硬规则逐条

  • 关单措辞:issue track: make suite/smoke failures visible in the run conclusion #3399 与 PR track: fail the run when the upstream suite or container smoke did not pass #3400 正文只有 Related #3399,无 Fixes / Closes / Resolves。
  • 绑 head:QA 证据绑 59a1eb15,我复核的 blob 7c83447e… / tree bc38d807… 与 QA 一致;任何新提交即作废。
  • 本地绿 ≠ CI 绿:本地 = bash -n 6/6 + 末步 8 组干跑 + YAML 解析(steps=8);CI = 16/16 全绿,但这些绿没有一个执行过新增的那一步(track 工作流 total_count 0)。
  • risk 由脚本打:risk:T3 来自 node .github/scripts/risk-gate.mjs --pr 3400,stdout 逐字贴在本 PR 的 risk 注释里(#issuecomment-7188222995),不是我手判。.github/** 命中 T3 paths。

3. 我确认的设计裁决

  1. if: always() && steps.target.outputs.skip == 'false' —— 跳过日(已 pin / 分支已存在)不跑、不红,符合「skip 不是红」。
  2. skipped 单独一档、不加 ::error::、不计入 failed —— 前序步骤已经红过,这里再加注解是把人引向 suite/smoke 而真正挂的可能是 Sync,属归错因。Runtime Dev 顺手把「both passed」守卫从 failed == 0 收成两项都 success,我确认采纳(更严,不放松)。
  3. SUITE=''(步骤没跑,env 是空串)判失败 —— 保守方向正确。

4. 结论

评审通过,可合并 —— 但 T3 人工批准未完成,本 PR 不得由我合并。 这是第 4 阶段的试点要验的那个闸口:脚本判 T3、人批、才合。

合并后必须接着做的一件事(写在这里免得被绿勾盖掉):新步骤的第一次真检验是合并后 track 工作流的第一次 schedule 或手动 workflow_dispatch。在那之前,「suite 挂了 → run 会红」这句话在本仓库从未被真实执行验证过。若想让它进 PR 门,需要另一个切片给它加 pull_request 触发器(会连带把 tag 从 :track 与 :test 对齐,属独立评审)。

本评审不构成验收通过,不声称与 0.3.0 parity。

Related #3399

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-pr Pull request opened by an agent risk:T3 Risk tier T3 (needs a human approval), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant