跳到正文
原文
Google AI:DEV 作者专属(RSS)· gracefullight·· 6 小时前AI 评分37

oh-my-agent(OMA)测试门失败时返回什么

What OMA returns when its test gate fails

AI 导读

oh-my-agent(OMA)在活跃工作流尝试停止时会重跑配置的测试脚本,测试门失败时 Stop hook 返回 "decision":"block" 及原因 Stop gate 'test' FAILED (reinforcement 1/5),而 oma hook run 进程本身仍以退出码 0 结束。

正文

gracefullight

oh-my-agent (OMA) can rerun a configured test script when an active workflow
tries to stop. This example exercises that behavior with manual hook calls and
a deliberately broken expiry check. It uses the OMA 15.0.13 source CLI.

The fixture defines an item as expired at now === expiresAt. Its implementation
used >, so the boundary test failed. The test process exited with code 1.
This excerpt comes from the actual output:

not ok 2 - at expiry: expired
# pass 2
# fail 1

The fixture's active Ralph workflow had a test completion gate. A manual
call to OMA's Stop hook reran the package's test script. The response contained
"decision":"block" and this reason:

Stop gate 'test' FAILED (reinforcement 1/5).

The oma hook run process itself exited with code 0. Its JSON decision carries
the block; treating that exit code as a successful test would be incorrect.

The fix changed one comparison:

-  return now > expiresAt;
+  return now >= expiresAt;

Rerunning the tests produced:

# pass 3
# fail 0

The next Stop call ran the same gate and returned empty stdout. OMA removed the
fixture's workflow state and recorded gate.passed, followed by session.ended
with reason completion_gate_passed.

The demo, receipts, and reproduction script contain the full
commands, timestamps, and output. Download reproduce.py and run it against an
OMA source checkout with its CLI dependencies already available:

python3 reproduce.py --oma-source /path/to/oh-my-agent --output /path/to/new-demo-run

Download demo.html from the Gist to watch the 45-second explanation locally. GitHub displays its source rather than playing it on the page.

The script requires Python 3, Git, Node, and Bun. It creates an isolated fixture
and session store; it does not change your project's workflow state.

This is a local fixture with manually invoked hooks, not a recorded autonomous
agent session or a production incident. It demonstrates this configured gate
on these tests. It does not establish general correctness or a comparison with
another tool.

The full harness supplies the CLI and hooks used here. A skills-only install
does not. Start with one scoped task in the
Quick Start,
then inspect its diff and checks. The source is on
GitHub.

来源:Google AI:DEV 作者专属(RSS) · dev.to