Conversation
state="exited" alone doesn't mean success -- a job whose command ran but exited nonzero looked identical to a real success, both a plain gray "exited" badge. The API already returns output.exit_code in the list payload; the badge/label just never read it. exited+exit_code:0 now renders "done" (neutral styling); exited with a nonzero code renders "failed" (urgent styling), matching real failed/killed jobs. Detail view gets the same treatment. output can be null (seen on failed jobs) so both helpers use optional chaining. Agentflare-Agent: claude-code Agentflare-Branch: task/54 Agentflare-Item: 54
📝 WalkthroughWalkthroughThe dashboard now uses exit codes for exited jobs. Zero exit codes display as ChangesJob status presentation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Agentflare-Agent: claude-code Agentflare-Branch: task/54 Agentflare-Item: 54
Agentflare-Agent: claude-code Agentflare-Branch: task/54 Agentflare-Item: 54
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dashboard/web/jobs.html`:
- Around line 281-287: Update the exited-state handling in the priority mapper
and stateLabel method to recognize only numeric, nonzero exit codes as failures.
For nullish or otherwise missing exitCode values, return the existing neutral
priority and an explicit unknown/neutral label instead of urgent or failed;
preserve the done mapping for numeric zero and the existing failed/killed
behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e1ec2062-8415-4668-9712-dfdb5bd8423f
📒 Files selected for processing (1)
dashboard/web/jobs.html
| if (state === 'exited') return exitCode === 0 ? 'af-prio af-prio-low' : 'af-prio af-prio-urgent'; | ||
| if (state === 'failed' || state === 'killed') return 'af-prio af-prio-urgent'; | ||
| return ''; | ||
| }, | ||
|
|
||
| stateLabel(state, exitCode) { | ||
| if (state === 'exited') return exitCode === 0 ? 'done' : 'failed'; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Handle missing exit codes before applying the failure mapping.
When output is missing, Line 96 can pass undefined, and detailExitCode can be null. Lines 281 and 287 then classify an exited job as urgent and failed. Reserve failed and urgent styling for nonzero numeric exit codes. Use an explicit neutral or unknown fallback for nullish values.
Suggested fix
- if (state === 'exited') return exitCode === 0 ? 'af-prio af-prio-low' : 'af-prio af-prio-urgent';
+ if (state === 'exited') {
+ if (exitCode === null || exitCode === undefined) return 'af-prio af-prio-medium';
+ return exitCode === 0 ? 'af-prio af-prio-low' : 'af-prio af-prio-urgent';
+ }
- if (state === 'exited') return exitCode === 0 ? 'done' : 'failed';
+ if (state === 'exited') {
+ if (exitCode === null || exitCode === undefined) return 'exited';
+ return exitCode === 0 ? 'done' : 'failed';
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (state === 'exited') return exitCode === 0 ? 'af-prio af-prio-low' : 'af-prio af-prio-urgent'; | |
| if (state === 'failed' || state === 'killed') return 'af-prio af-prio-urgent'; | |
| return ''; | |
| }, | |
| stateLabel(state, exitCode) { | |
| if (state === 'exited') return exitCode === 0 ? 'done' : 'failed'; | |
| if (state === 'exited') { | |
| if (exitCode === null || exitCode === undefined) return 'af-prio af-prio-medium'; | |
| return exitCode === 0 ? 'af-prio af-prio-low' : 'af-prio af-prio-urgent'; | |
| } | |
| if (state === 'failed' || state === 'killed') return 'af-prio af-prio-urgent'; | |
| return ''; | |
| }, | |
| stateLabel(state, exitCode) { | |
| if (state === 'exited') { | |
| if (exitCode === null || exitCode === undefined) return 'exited'; | |
| return exitCode === 0 ? 'done' : 'failed'; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@dashboard/web/jobs.html` around lines 281 - 287, Update the exited-state
handling in the priority mapper and stateLabel method to recognize only numeric,
nonzero exit codes as failures. For nullish or otherwise missing exitCode
values, return the existing neutral priority and an explicit unknown/neutral
label instead of urgent or failed; preserve the done mapping for numeric zero
and the existing failed/killed behavior.
Auto-opened on
item donefor kj1JIe2WyPvVoOBz_clSZ.Summary by CodeRabbit