Skip to content

feat: generalize debug thread view and improve UI contrast#216

Open
Pavilion4ik wants to merge 1 commit into
openedx:mainfrom
raccoongang:feature/improvements-to-debug-thread-function
Open

feat: generalize debug thread view and improve UI contrast#216
Pavilion4ik wants to merge 1 commit into
openedx:mainfrom
raccoongang:feature/improvements-to-debug-thread-function

Conversation

@Pavilion4ik
Copy link
Copy Markdown
Contributor

@Pavilion4ik Pavilion4ik commented May 5, 2026

What?

This PR generalizes the AI Workflow Session DEBUG view to support non-threaded orchestrators and processors, while also significantly improving the UI contrast of the debug interface.

Key Technical Changes

  • Decoupled Debug Logic: Moved debug message generation from the admin view/model directly to the orchestrators
  • Generic Interface: Introduced get_debug_messages() in BaseOrchestrator
  • Metadata Integration: SessionBasedOrchestrator now synthesizes debug messages from session metadata (task status, results, errors), enabling debugging for "one-shot" workflows that don't use threaded conversation history
  • Specialized Debugging: Added custom overrides for FlashCardsOrchestrator and EducatorAssistantOrchestrator to surface internal state like generated cards or collection URLs
  • UI/UX Accessibility: Overhauled the CSS in the debug_thread.html template
    • Increased text contrast (fixing the "grey-on-white" issue)
    • Added distinct borders
    • Improved color-coding for different message roles (User, Assistant, System, Error)

Why?

  • Extensibility: Previously, the DEBUG view only worked for workflows inheriting from the threaded orchestrator. This limitation prevented developers from inspecting the state of newer, non-threaded execution models
  • Visibility: Debugging information is only useful if it's readable. The previous UI had poor contrast ratios, making it difficult to distinguish between user inputs and system logs in the Django admin
  • Consistency: By delegating to the orchestrator, we ensure that as new workflow types are added, they can provide their own relevant debugging context through a unified interface

Issue: #204

- Extend debug thread support to non-threaded orchestrators and processors
- Delegate debug message generation to orchestrators via get_debug_messages()
- Synthesize debug info from session metadata for one-shot workflows
- Add specialized debug data for flashcards and educator assistant workflows
- Improve UI contrast and readability in the admin debug thread view
- Darken text and enhance message bubble styling for better visibility
- Add tests to verify debug message generation from session metadata
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label May 5, 2026
@openedx-webhooks
Copy link
Copy Markdown

Thanks for the pull request, @Pavilion4ik!

This repository is currently maintained by @felipemontoya.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.09%. Comparing base (3aefaad) to head (0e11677).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #216      +/-   ##
==========================================
- Coverage   95.13%   95.09%   -0.05%     
==========================================
  Files          67       67              
  Lines        7322     7403      +81     
  Branches      387      395       +8     
==========================================
+ Hits         6966     7040      +74     
- Misses        267      269       +2     
- Partials       89       94       +5     
Flag Coverage Δ
unittests 95.09% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions May 7, 2026
Copy link
Copy Markdown
Member

@felipemontoya felipemontoya left a comment

Choose a reason for hiding this comment

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

I have not yet tested this in my dev, but overall looks good. I'll come back aftertrying it

"""
Return debug messages from the session's thread and metadata.
"""
import json # pylint: disable=import-outside-toplevel
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we move this out to the top? something as basic as json should not conflict

session-based ones) should override this to provide relevant
interaction history or state.
"""
return []
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

would it make sense to return a message like

                "role": "system",
                "content": f"your {classname} orchestrator does not support debug messages",
                "source": "system",

so that when the orchestrator does not override this, the user gets the right info?

Copy link
Copy Markdown
Member

@felipemontoya felipemontoya left a comment

Choose a reason for hiding this comment

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

After the static commit I tried to run this in my local environment to no avail.

The debug view continues to work for threaded openai threaded conversations and does not work for other types of orchestrator (e.g the educator_question assist)

I believe this comes down to the fact that we are not storing the remote_id or the submission id in the non-threaded orchestrators. I think making this work more reliably would require that.

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

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

4 participants