Skip to content

Conversation

@Lucius1274
Copy link
Collaborator

@Lucius1274 Lucius1274 commented Jan 28, 2026

Added a default cancel message for job cancellation to overwrite outdated task status messages

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced task cancellation to provide clearer feedback when pending tasks are manually canceled, improving visibility into cancellation operations.

✏️ Tip: You can customize this high-level summary in your review settings.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Lucius1274, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves the clarity of job cancellation statuses by introducing a specific default message for manually canceled DICOM tasks. This change addresses potential ambiguity where tasks might have previously retained less informative status messages upon cancellation, ensuring users receive a precise reason for the task's termination.

Highlights

  • Default Cancel Message: A default message, "Task manually canceled", is now explicitly set when a DICOM task is canceled. This ensures that the task's message field provides clear context for the cancellation, preventing outdated or generic status messages.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

📝 Walkthrough

Walkthrough

In DicomJobCancelView.post, when canceling pending tasks, the update operation now sets a message field to "Task manually canceled" alongside the status change to CANCELED. The remaining cancellation logic for queued tasks and in-progress status transitions is unchanged.

Changes

Cohort / File(s) Summary
Task Cancellation Message
adit/core/views.py
Updated pending DICOM task cancellation to include a message field ("Task manually canceled") in addition to the status update to CANCELED

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A message in the cancel, so tidy and neat,
Tasks once pending now bow in retreat,
"Manually canceled" the rabbit now sings,
One line changed, but oh what it brings! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main change: adding a default cancel message when tasks are manually canceled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@claude
Copy link

claude bot commented Jan 28, 2026

Code Review - PR #290: Added default cancel message

Summary

This PR adds a default message "Task manually canceled" when tasks are canceled, addressing the issue where canceled tasks would retain outdated status messages from their previous state.

Positive Aspects ✅

  1. Clear Intent: The change directly addresses the issue described - providing a clear cancellation message instead of leaving potentially confusing outdated messages from prior task states.

  2. Minimal Impact: Single-line change with very focused scope reduces risk of unintended side effects.

  3. Consistent with Codebase Patterns: The approach follows the existing pattern of setting the message field during status transitions (as seen in adit/core/tasks.py:120, 125, 140, etc.).

  4. User-Facing Benefit: The message field is displayed in the UI (adit/core/templates/core/_dicom_task_detail.html:26), so this improves user experience by providing accurate status information.

Suggestions for Improvement

1. Test Coverage

The existing test in adit/core/tests/test_views.py:66-87 verifies that tasks are canceled but doesn't assert the message field is set. Consider adding an assertion:

task.refresh_from_db()
assert task.status == DicomTask.Status.CANCELED
assert task.message == "Task manually canceled"  # Add this assertion

This would:

  • Document the expected behavior
  • Prevent regression if someone removes the message in the future
  • Align with testing best practices shown elsewhere in the codebase

2. Message Consistency

Consider whether the message should be more specific about it being a manual cancellation vs. other potential cancellation scenarios (e.g., timeout, system abort). The current message "Task manually canceled" is good, but you might want to verify:

  • Is manual cancellation the only way tasks can be canceled?
  • If not, should automatic cancellations have a different message?

Looking at the code, this appears to be the only cancellation path (user-initiated via the UI), so "Task manually canceled" is appropriate.

3. Documentation

The PR description is concise but could benefit from:

  • Example of what the "outdated task status messages" looked like before
  • Screenshot or example showing the improvement (if applicable)

Code Quality Assessment

Style: ✅ Follows project conventions (100-char line length, clear intent)
Security: ✅ No security concerns
Performance: ✅ No performance impact
Best Practices: ✅ Consistent with existing patterns
Potential Bugs: ✅ None identified

Recommendation

Approve with minor suggestion: The change is good as-is and ready to merge. The only enhancement would be adding a test assertion to verify the message is set correctly, but this is optional.


Overall: This is a solid, focused improvement that addresses a real UX issue. The implementation is clean and follows existing patterns in the codebase. Nice work! 🎯

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a default message to tasks when a job is canceled, which is a good improvement for providing clearer status information. My only suggestion is to avoid hardcoding the message string directly in the view. It would be better to define it as a constant on the DicomTask model for better maintainability and reusability.

app.job_manager.cancel_job_by_id(queued_job_id, delete_job=True)
tasks.update(status=DicomTask.Status.CANCELED)
tasks.update(status=DicomTask.Status.CANCELED, message="Task manually canceled")

Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While adding a cancellation message is a good idea, hardcoding the string here is not ideal for maintainability. It would be better to define this message as a constant on the DicomTask model (e.g., DicomTask.MANUALLY_CANCELED_MESSAGE) and reference it here. This makes the message reusable and easier to manage if it needs to be changed in the future.

@claude
Copy link

claude bot commented Jan 28, 2026

Code Review - PR #290: Added default cancel message

Summary

This PR adds a default message "Task manually canceled" when tasks are canceled, addressing the issue where canceled tasks would retain outdated status messages from their previous state.

Positive Aspects ✅

  1. Clear Intent: The change directly addresses the issue described - providing a clear cancellation message instead of leaving potentially confusing outdated messages from prior task states.

  2. Minimal Impact: Single-line change with very focused scope reduces risk of unintended side effects.

  3. Consistent with Codebase Patterns: The approach follows the existing pattern of setting the message field during status transitions (as seen in adit/core/tasks.py:120, 125, 140, etc.).

  4. User-Facing Benefit: The message field is displayed in the UI (adit/core/templates/core/_dicom_task_detail.html:26), so this improves user experience by providing accurate status information.

Suggestions for Improvement

1. Test Coverage

The existing test in adit/core/tests/test_views.py:66-87 verifies that tasks are canceled but doesn't assert the message field is set. Consider adding an assertion:

task.refresh_from_db()
assert task.status == DicomTask.Status.CANCELED
assert task.message == "Task manually canceled"  # Add this assertion

This would:

  • Document the expected behavior
  • Prevent regression if someone removes the message in the future
  • Align with testing best practices shown elsewhere in the codebase

2. Message Consistency - Consideration for Future

The current message "Task manually canceled" clearly indicates user-initiated cancellation. If there are future scenarios where tasks might be canceled automatically (e.g., timeout, system abort), those should use different messages for clarity.

Looking at the current codebase, this appears to be the only cancellation path (user-initiated via DicomJobCancelView), so the message is appropriate.

3. Resume Behavior

When tasks are resumed via DicomJobResumeView (line 262), the status changes from CANCELED to PENDING, but the message field is not cleared. This means resumed tasks will still show "Task manually canceled" until they start processing and get a new message. Consider whether this is the desired behavior or if the message should be cleared during resume.

Code Quality Assessment

Style: ✅ Follows project conventions (100-char line length, clear intent)
Security: ✅ No security concerns
Performance: ✅ No performance impact
Best Practices: ✅ Consistent with existing patterns
Potential Bugs: ✅ None identified

Recommendation

Approve with minor suggestions: The change is solid and ready to merge. The suggestions above are optional enhancements that could be addressed in this PR or future improvements:

  • High value: Add test assertion for the message field
  • Consider: Whether to clear the message when resuming canceled tasks

Overall: This is a focused improvement that addresses a real UX issue. The implementation is clean and follows existing patterns in the codebase. Nice work! 🎯

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.

2 participants