Repository navigation
fix(lua-agent-builder): the post-deploy smoke check runs in the agent project the deploy ran in (1.17.2) - #31
Conversation
… project the deploy ran in (1.17.2) Claude Code runs hooks from its own directory, so after `cd agents/x && <deploy>` the ping and log scan ran outside the project; lua-cli exited 2 (no lua.skill.yaml) and every deploy reported "agent did not respond". The check now resolves the project from the hook's cwd plus any literal cd before the lua command, says it was skipped when it cannot tell, and names lua-cli's own reason when the ping fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
selcuk-lua
left a comment
There was a problem hiding this comment.
Code review — LOW risk
Focused, well-tested bug fix: post-deploy-smoke now runs its lua chat ping and lua logs scan in the agent project the deploy actually ran in (derived from the hook's cwd plus literal cd prefixes via the new luaWorkingDirs, then walking up to the nearest lua.skill.yaml), instead of the hook process's own directory. The hook remains non-blocking (warn only), distinguishes skip/timeout/failure cleanly, and the new paths are covered by tests including the cwd-passing regression. Version bumps (1.17.2) are consistent across plugin, marketplace, MCP package/lock/bundle, server, api-client and CHANGELOG. Nothing blocking.
Minor
hooks/post-deploy-smoke.mjs:36—deployProjectDirtrustsinput.cwdwithout checking it exists; a vanished or relative cwd yields a benign 'skipped' message rather than a real check. Optionally guard the start directory, or document the behavior.lib/tokenizer.mjs:1035—luaWorkingDirsassumes every top-levelcdbefore the lua command is actually taken (conditionals likefalse && cd a && lua …are treated as taken). Fine for a warn-only heuristic; tighten the doc comment to say so.hooks/post-deploy-smoke.mjs:40— a failed ping now echoesfirstLine(ping.stderr)into the model context. Low risk given the single-line / 200-char cap; consider restricting to the known✖ usage:prefix if you want to avoid echoing unexpected stderr.
PR Risk Reviewer — automated senior review of f4b8aca · risk: low · confidence: 0.82
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
selcuk-lua
left a comment
There was a problem hiding this comment.
Code review — LOW risk
Previously flagged
- Previously flagged deployProjectDir trusts input.cwd without validating it exists — still open (advisory).
deployProjectDir(hooks/post-deploy-smoke.mjs:36) still starts frominput?.cwd ?? process.cwd()and resolvescdprefixes without checking the directory exists; a missing/relative cwd degrades to a benign 'skipped' message. Minor and acceptable. - Previously flagged luaWorkingDirs cd-ordering semantics — still open (advisory).
luaWorkingDirs(lib/tokenizer.mjs:1035) still assumes every top-levelcdbefore the lua command is taken; the doc comment was not tightened. Fine for a warn-only heuristic. - Previously flagged firstLine surfaces lua-cli stderr into Claude context — still open (advisory). A failed ping still echoes
firstLine(ping.stderr)(capped to one line / 200 chars). Low risk.
This revision is effectively the same code reviewed at f4b8aca015; the new commits did not change the smoke-check logic or luaWorkingDirs, and all three carryover items are minor, non-blocking notes. Version bumps to 1.17.2 are consistent across plugin, marketplace, MCP package/lock/bundle, server and api-client, and the new behavior stays non-blocking (warn only) with good test coverage. Safe to merge.
Minor
hooks/post-deploy-smoke.mjs:36—deployProjectDirtrustsinput.cwdwithout checking it exists; a vanished or relative cwd yields 'skipped' rather than a real check. Optionally guard the start dir or document the behavior.lib/tokenizer.mjs:1035—luaWorkingDirscounts every top-levelcdbefore the lua command as taken (e.g.false && cd a && lua …). Tighten the doc comment to state the assumption.hooks/post-deploy-smoke.mjs:40— a failed ping echoesfirstLine(ping.stderr)into model context. Consider restricting to the known✖ usage:prefix if you want to avoid passing arbitrary stderr through.
PR Risk Reviewer — automated senior review of b616c0e · risk: low · confidence: 0.82
PR Risk Reviewer — automated senior review of b616c0e · risk: low · confidence: 0.82 · re-review · round 2
… ping Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Two follow-ups since the approval, both from CI: the skipped-check hint now suggests a ping on a fresh thread ( |
selcuk-lua
left a comment
There was a problem hiding this comment.
Code review — LOW risk
Previously flagged
- Previously flagged deployProjectDir trusts input.cwd without validating it exists — still open (advisory).
hooks/post-deploy-smoke.mjs:36still starts frominput?.cwd ?? process.cwd()with no existence check; a missing/relative cwd degrades to a benign 'skipped' message. The new commits only added the-thint and two tests, not a guard. Minor. - Previously flagged luaWorkingDirs cd-ordering semantics — still open (advisory).
lib/tokenizer.mjs:1035is unchanged; the doc comment still does not note that short-circuitedcdsegments are assumed taken. Fine for a warn-only heuristic. - Previously flagged firstLine surfaces lua-cli stderr into Claude context — still open (advisory). A failed ping still echoes
firstLine(ping.stderr)(one trimmed line, 200-char cap). Low risk.
The round-3 changes are small and safe: the skipped-check message now suggests pinging on a fresh thread (-t, matching the plugin's own lint rule), and two new tests (home-folder cd resolution, a failed ping with no output) hold hooks/ at 100% coverage. The smoke-check logic and luaWorkingDirs are otherwise unchanged from the prior round, the hook stays non-blocking (warn only), and version bumps to 1.17.2 are consistent across plugin, marketplace, MCP package/lock/bundle, server and api-client. All three carryover items are minor, non-blocking notes. Safe to merge.
Minor
hooks/post-deploy-smoke.mjs:36—deployProjectDirtrustsinput.cwdwithout checking it exists; a vanished or relative cwd yields 'skipped' rather than a real check. Optionally guard the start dir or document the behavior.lib/tokenizer.mjs:1035—luaWorkingDirscounts every top-levelcdbefore the lua command as taken (e.g.false && cd a && lua …). Tighten the doc comment to state the assumption.hooks/post-deploy-smoke.mjs:40— a failed ping echoesfirstLine(ping.stderr)into model context. Consider restricting to the known✖ usage:prefix if you want to avoid passing arbitrary stderr through.
PR Risk Reviewer — automated senior review of 3087bf4 · risk: low · confidence: 0.85 · re-review · round 3
What was wrong
After every deploy or promote,
post-deploy-smokewarnedagent did not respond (exit=2)even though the agent answered. bs-tester saw it on every promote, on staging and in prod (2026-10-29).Cause, reproduced locally with lua-cli 3.62.0 and 3.63.0:
cd'd into.cd agents/shop && <deploy>, the pinglua chat --ci -e production -m pingtherefore ran outside the agent project. lua-cli exits 2 there:✖ usage: No lua.skill.yaml found.pong.lua logsscan had the same problem.Fix (the whole class: every lua command the hook runs)
deployProjectDir(command, cwd)finds the project the deploy ran in:cwdin the hook input;detect-projectandinject-contextalready prefer it);cdbefore the lua command (luaWorkingDirsinlib/tokenizer.mjs, top-level segments, using the gate's own lexer);lua.skill.yaml.spawnLuatakes acwd).cd,cd -, or no project there or above), the check says it was skipped. It never blames the agent.Tests
cdand from a subfolder;luaWorkingDirson 8 shapes, including computedcd,cd -, quoted paths and acdafter the lua command.cwdpassed to the spawns, the two project-location tests fail (2 failed / 48).🤖 Generated with Claude Code