Skip to content

fix(dashboard): jobs list badge doesn't distinguish success from failure - #430

Merged
getappz merged 4 commits into
masterfrom
task/54
Aug 10, 2026
Merged

fix(dashboard): jobs list badge doesn't distinguish success from failure#430
getappz merged 4 commits into
masterfrom
task/54

Conversation

@getappz

@getappz getappz commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Auto-opened on item done for kj1JIe2WyPvVoOBz_clSZ.

Summary by CodeRabbit

  • Improvements
    • Job status badges and details now show clearer completion states.
    • Completed jobs display done when successful and failed when they exit with an error.
    • Status badge urgency now reflects the job’s exit result.

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
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The dashboard now uses exit codes for exited jobs. Zero exit codes display as done with low urgency. Non-zero exit codes display as failed with urgent styling.

Changes

Job status presentation

Layer / File(s) Summary
Exit-aware status labels and badges
dashboard/web/jobs.html
stateClass and stateLabel now interpret exit codes. Job-list badges and detail indicators display done or failed with matching urgency styles. Other job states retain their existing labels.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • getappz/agentflare#375: Both changes update job state and exit-code display logic in dashboard/web/jobs.html.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description does not include the required Summary, Test plan, or Notes for reviewers sections. Add the required sections and document the change, test results, risk areas, and backwards compatibility.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: distinguishing successful and failed jobs in the dashboard badge.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/54

Comment @coderabbitai help to get the list of available commands.

@getappz getappz changed the title dashboard: jobs list badge doesn't distinguish success from failure fix(dashboard): jobs list badge doesn't distinguish success from failure Aug 10, 2026
shiva added 2 commits August 10, 2026 15:10
Agentflare-Agent: claude-code
Agentflare-Branch: task/54
Agentflare-Item: 54
Agentflare-Agent: claude-code
Agentflare-Branch: task/54
Agentflare-Item: 54
@getappz
getappz enabled auto-merge (squash) August 10, 2026 09:49
@getappz
getappz merged commit 8b8fc3f into master Aug 10, 2026
16 of 17 checks passed
@getappz
getappz deleted the task/54 branch August 10, 2026 10:53

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between cfee6b5 and 42968e9.

📒 Files selected for processing (1)
  • dashboard/web/jobs.html

Comment thread dashboard/web/jobs.html
Comment on lines +281 to +287
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';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Suggested change
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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant