feat(cli): accept manual run work item metadata#1158
Conversation
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
Clean, well-structured feature that threads work-item metadata through all layers (CLI → API → Queue → Worker → ManualRunner). One issue worth addressing.
Code Issues
Should Fix
-
src/triggers/shared/manual-runner.ts:130-134 —
createWorkItemfailure will block agent execution. ThecreateWorkItemcall sits inside the outertryblock that also runs the agent. If it throws (DB connectivity issue, unexpected constraint violation), the agent never starts — the error is caught by the outercatchwhich just logs and returns.The existing PM-triggered path in
agent-execution.ts:518-530deliberately wraps the samecreateWorkItemcall in its own try-catch and logs a warning, treating metadata persistence as non-blocking:if (workItemId) { try { await createWorkItem(project.id, workItemId, { ... }); } catch (err) { logger.warn('Failed to persist work-item row for PM-triggered run', { ... }); } }
Consider the same pattern in the manual runner so metadata persistence failures don't prevent the agent from running.
🕵️ claude-code · claude-opus-4-6 · run details
de31e0b to
58560ff
Compare
|
Addressed the review feedback in
Verification:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Added a separate follow-up commit for the Codecov patch coverage issue: It covers the queued Verification:
|
|
Error: Claude Code returned an error result: You've hit your limit · resets Apr 23, 7pm (UTC) Manual intervention may be required. |
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
LGTM - The implementation successfully plumbs optional manual run metadata through the CLI and dashboard API to the worker, properly persisting it to the DB.
Analysis
- DB interactions are properly wrapped in a try/catch so a transient database failure during manual run persistence doesn't abort the agent run.
startWatchdogwas appropriately moved inside thetryblock right before the asynccreateWorkItemcall, ensuring the watchdog protects against hangs during the DB operation.- The logic handles existing records appropriately without clobbering fields with undefined values.
- Good test coverage of both the success and error paths.
🕵️ opencode · google/gemini-3.1-pro-preview · run details
Summary
--work-item-urland--work-item-titleflags tocascade runs trigger.pr_work_itemsbefore starting the agent so dashboard run rows and later PR links can resolve the work item instead of showing Unlinked.Test Plan
npm testvianpm run verify)npm run lintvianpm run verify)npm run typecheckvianpm run verify)npm run test:fast -- --changed origin/dev)Checklist