Skip to content

feat!: remove the XQueue service settings, callback and the MATLAB API key - #39405

Merged
feanil merged 4 commits into
openedx:masterfrom
feanil:feanil/remove-legacy-xqueue-matlab
Nov 25, 2026
Merged

feanil merged 4 commits into
openedx:masterfrom
feanil:feanil/remove-legacy-xqueue-matlab

Conversation

@feanil

@feanil feanil commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

The XQueue service is deprecated and its repo archived (openedx/public-engineering#286). The LMS queues external grader submissions in edx-submissions, serves the API that xqueue-watcher polls, and gets scores back through the EXTERNAL_GRADER_SCORE_SUBMITTED signal. This removes the platform code that only existed for the old service, and the MATLAB handling that only worked through it (openedx/public-engineering#192).

Bumps xblocks-core to 4.0.0, which has openedx/xblocks-core#338. That PR changes XQueueInterface to take only the block and drops the matlab_api_key argument to LoncapaSystem. The bump has to land with the two commits before it: with the new xblocks-core and the old mixin, the "Matlab API key" box comes back in Studio.

The bump also needs a test fix in test_lti_integration.py: xblocks-core 3.1.0 (openedx/xblocks-core#336) started passing i18n_service to the template in LTIBlock.preview_handler, and master is still on 3.0.0, so this PR is the first to pull that in.

XQueue

  • XQUEUE_INTERFACE is gone from the settings, the mock YAML and the test settings, along with XQUEUE_PORT. XQUEUE_WAITTIME_BETWEEN_REQUESTS stays, since it is the wait a learner has to observe between submissions to a queued problem and the in-platform queue still enforces it.
  • The xqueue_callback view and its two URL patterns are gone. handle_external_grader_score in lms/djangoapps/grades/signals/handlers.py already does the same job in-process.
  • XQueueService no longer builds HTTP auth or a callback URL, and the send_to_submission_course.enable course waffle flag that picked between the two backends is gone. Every course's external grader submissions go to edx-submissions.
  • Sites still on the XQueue server need to drain it before upgrading. A result for a submission still queued there has no callback URL to come back to. The Willow operator notes will say so.

MATLAB

  • The matlab_api_key field is gone from ProblemBlock and from the inheritance mixin that put it on the course's Advanced Settings, along with the ungraded_response ajax handler and the MATLAB wording on the Studio import and export pages.
  • Existing <matlabinput> problems still parse: xblocks-core keeps the tag on CodeInput, so learners keep their scores. A new submission on one is refused with "MATLAB problems can no longer be graded." and doesn't use an attempt.
  • The cms tests that used matlab_api_key as a sample synced settings field use source_code instead.

Follow-ups outside this PR

@feanil
feanil force-pushed the feanil/remove-legacy-xqueue-matlab branch from 33c21d2 to f7b6726 Compare November 24, 2026 15:01
@feanil
feanil marked this pull request as ready for review November 24, 2026 15:08
@feanil
feanil requested a review from ormsbee November 24, 2026 15:08
feanil added a commit that referenced this pull request Nov 24, 2026
The 4.0.0 upgrade lands separately, with the platform changes it needs,
in #39405, so keep it
out of this requirements bump.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
feanil added a commit to feanil/docs.openedx.org that referenced this pull request Nov 24, 2026
openedx/openedx-platform#39405 removes the send_to_submission_course.enable
flag, XQUEUE_INTERFACE, the xqueue_callback view and the MATLAB
integration, so from Willow every course's submissions go to
edx-submissions and nothing is left to turn on
(openedx/openedx-platform#39405).

The flag steps stay for Teak through Verawood, marked as such, since
migrating course by course before the upgrade is still the safer path.
The migration guide gains a section for operators who migrate during a
Willow upgrade: drain the old queues first, since a Willow LMS has no
callback URL for the XQueue service's results.  Both pages now say what
an operator sees on a <matlabinput> problem.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@ormsbee ormsbee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A few small things inline. The one I care about most is having test_three_files go through to edx-submissions for real, since the LMS is the only place where all the pieces of this run together.


Claude usage details

Claude drafted this review and ran these on 64a6a6a:

  • The eight test files this PR changes, plus test_score_render.py (Python 3.12, Django 5.2, SQLite, MongoDB 7.0): 435 passed with the LMS settings, 31 with the CMS settings.
  • Trial merge with master (927faf6): no conflicts, uv lock --check passes, and the same tests pass.
  • Throwaway version of test_three_files with nothing mocked: passed. See the inline comment. Not in the branch.
  • Throwaway import and export of a course that has matlab_api_key in its OLX: see the inline comment on inheritance.py. Not in the branch.

Model: Claude Fable 5.2 (claude-fable-5-2)

self.refresh_course()

@patch.object(XQueueInterface, '_http_post')
@patch.object(XQueueInterfaceSubmission, 'send_to_submission')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could this run with nothing mocked, now that the hand-off is a function call instead of an HTTP request? With send_to_submission patched, none of the platform's tests reach the real queue, and the handler tests in test_score_render.py all give handle_external_grader_score() a MagicMock block. So nothing checks that a grader can pull a real problem's submission, or that its result makes it back to the learner, and the LMS is the only place where xblocks-core, edx-submissions and that handler run together.

Claude tried it as a throwaway test, and this passes on this branch (it needs Client, UserFactory and ExternalGraderDetail imported):

    def test_three_files(self):
        # Open the test files, and arrange to close them later.
        filenames = "prog1.py prog2.py prog3.py"
        fileobjs = [
            open(os.path.join(settings.COMMON_TEST_DATA_ROOT, "capa", filename))
            for filename in filenames.split()
        ]
        for fileobj in fileobjs:
            self.addCleanup(fileobj.close)

        self.problem_setup("the_problem", filenames)
        resp = self.submit_question_answer("the_problem", {'2_1': fileobjs})

        assert resp.status_code == 200
        json_resp = json.loads(resp.content.decode('utf-8'))
        assert json_resp['success'] == 'incorrect'

        # The submission and its files are waiting in edx-submissions for a grader.
        external_grader = ExternalGraderDetail.objects.get()
        assert external_grader.status == 'pending'
        assert sorted(f.original_filename for f in external_grader.files.all()) == filenames.split()

        # A grader pulls the submission from the LMS and posts a result, as xqueue-watcher does.
        grader = UserFactory(password="grader-password")
        grader.groups.create(name="xqueue")
        grader_client = Client()
        grader_client.post("/xqueue/login/", {"username": grader.username, "password": "grader-password"})
        pulled = grader_client.get("/xqueue/get_submission/", {"queue_name": external_grader.queue_name})
        submission = json.loads(pulled.json()["content"])
        assert sorted(json.loads(submission["xqueue_files"])) == filenames.split()
        grader_client.post("/xqueue/put_result/", {
            "xqueue_header": submission["xqueue_header"],
            "xqueue_body": json.dumps({"correct": True, "score": 1, "msg": "<p>Good job</p>"}),
        })

        # The learner's problem has the grader's result.
        module = StudentModule.objects.get(
            student=self.student_user, module_state_key=self.problem_location("the_problem")
        )
        assert module.grade == 1.0
        assert json.loads(module.state)["correct_map"]["the_problem_2_1"]["correctness"] == "correct"

I'd leave the ones in test_capa_block.py patched, since they don't go through the LMS's upload handling (Claude tried test_submit_problem_with_files unpatched, and edx-submissions fails on the plain file objects).

help=_("Enter the maximum number of times a student can try to answer problems. By default, Maximum Attempts is set to null, meaning that students have an unlimited number of attempts for problems. You can override this course-wide setting for individual problems. However, if the course-wide setting is a specific number, you cannot set the Maximum Attempts for individual problems to unlimited."), # pylint: disable=line-too-long
values={"min": 0}, scope=Scope.settings
)
matlab_api_key = String(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The commit body for this says "Course exports that carry matlab_api_key still import; the value is dropped", but the value isn't dropped. Now that it isn't a field, load_metadata() and apply_policy() keep it in xml_attributes, and it's written back out on export. Claude ran a throwaway test that imports a course with matlab_api_key in its policy.json and on a <problem>, then exports it. The key is in the export's policy.json, on the <course> element and on the <problem>.

That's absolutely the right behavior, since it's what happens to any attribute we don't recognize, and the keys are for a service that's gone. Please just fix the wording when you squash.

Comment thread cms/templates/export.html
studio_name=settings.STUDIO_SHORT_NAME
)}</p>
<p>${Text(_("{em_start}Caution:{em_end} When you export a course, information such as MATLAB API keys, LTI passports, annotation secret token strings, and annotation storage URLs are included in the exported data. If you share your exported files, you may also be sharing sensitive or license-specific information.")).format(
<p>${Text(_("{em_start}Caution:{em_end} When you export a course, information such as LTI passports, annotation secret token strings, and annotation storage URLs are included in the exported data. If you share your exported files, you may also be sharing sensitive or license-specific information.")).format(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FYI, the Authoring MFE has its own copies of these strings (export page, export footer, export sidebar, import sidebar), so they need the same edit. Could you add that to the follow-ups in the description?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Went ahead and made the PR for it: openedx/frontend-app-authoring#3387 It's linked from the follow-ups in the description too.

@@ -690,48 +690,6 @@ def load_single_xblock(request, user_id, course_id, usage_key_string, course=Non


@csrf_exempt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
@csrf_exempt


if settings.USE_EXTRACTED_LTI_BLOCK:
# Remove i18n service from the extracted LTI Block's rendered `preview_handler` content
generated_content = re.sub(r"\{.*?}", "{}", generated_content)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Question: I'm curious why this LTI change is mixed up in here. It's not a problem if it is, but I'm curious if it's some weird knock-on effect of the XQueue/MATLAB removal, or just something that was noticed along the way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's a knock-on from the xblocks-core bump, not from the removal itself. xblocks-core 3.1.0 started passing i18n_service to render_django_template in LTIBlock.preview_handler(openedx/xblocks-core#336), and master is still on 3.0.0, so this PR is the first to pull that in. The fix strips it the same way test_lti_constructor already does for student_view.

The MATLAB integration sent code to the MathWorks hosted service through
the XQueue service and got results back on the XQueue callback URL.
Neither exists any more, and xblocks-core has dropped MatlabInput and the
matlab_api_key argument to LoncapaSystem
(openedx/xblocks-core#338).
openedx/public-engineering#192 deprecated the
MATLAB handling in 2023 because the endpoint it talked to no longer
worked.

Remove the matlab_api_key field from ProblemBlock and from the
inheritance mixin that put it on the course's Advanced Settings, the
ungraded_response ajax handler that carried MATLAB's plot output, and the
MATLAB wording on the Studio import and export pages. The cms tests that
used matlab_api_key as a sample settings field use source_code instead.

Existing <matlabinput> problems still parse: xblocks-core keeps the tag
on CodeInput so learners keep their scores.

BREAKING CHANGE: the "Matlab API key" advanced setting is gone from
courses and problems. Course exports that carry matlab_api_key still
import, and the key is kept as an unrecognized attribute and written
back out on export, like any other attribute the platform does not
know.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
feanil and others added 3 commits November 24, 2026 15:08
The XQueue service is deprecated and its repo archived
(openedx/public-engineering#286). The LMS
queues external grader submissions in edx-submissions and serves the API
that xqueue-watcher polls, and scores come back through the
EXTERNAL_GRADER_SCORE_SUBMITTED signal. Nothing posts to the service any
more: xblocks-core's XQueueInterface only hands submissions to
edx-submissions (openedx/xblocks-core#338).

Remove what only existed for the service: the XQUEUE_INTERFACE setting
and its mock and test values, XQUEUE_PORT, the xqueue_callback view and
its two URL patterns, XQueueService's HTTP setup and construct_callback,
and the send_to_submission_course.enable course flag that picked between
the two backends. XQUEUE_WAITTIME_BETWEEN_REQUESTS stays: it is the wait
a learner has to observe between submissions to a queued problem.

BREAKING CHANGE: XQUEUE_INTERFACE is no longer read. The
send_to_submission_course.enable waffle flag is gone; every course's
external grader submissions now go to edx-submissions. The
/courses/<id>/xqueue/<user>/<block>/<dispatch> callback URL is gone.
Drain the XQueue server before upgrading: a result for a
submission still queued there has no callback URL to come back to.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
4.0.0 removes the legacy XQueue HTTP path and the MATLAB integration
(openedx/xblocks-core#338), which the two
commits before this one adapt the platform to.  XQueueInterface now
takes only the block, LoncapaSystem no longer accepts matlab_api_key,
and <matlabinput> problems refuse new submissions instead of queueing
them.

Release notes: https://github.com/openedx/xblocks-core/releases/tag/v4.0.0

BREAKING CHANGE: MATLAB problems can no longer be submitted.  They still
load and keep their scores.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
xblocks-core 3.1.0 started passing i18n_service to render_django_template
in LTIBlock.preview_handler
(openedx/xblocks-core#336), so the mocked render
output no longer matches the expected template call.  Strip it the same
way test_lti_constructor already does for student_view.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@feanil
feanil force-pushed the feanil/remove-legacy-xqueue-matlab branch from 64a6a6a to 7a2164f Compare November 24, 2026 20:09
feanil added a commit to feanil/docs.openedx.org that referenced this pull request Nov 24, 2026
openedx/openedx-platform#39405 removes the matlab_api_key field along
with the MATLAB integration
(openedx/public-engineering#192), so the
advanced problem editor no longer has that setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@feanil
feanil requested a review from ormsbee November 24, 2026 20:23
feanil added a commit to openedx/frontend-app-authoring that referenced this pull request Nov 24, 2026
The MATLAB integration and its matlab_api_key advanced setting are being
removed from the platform
(openedx/openedx-platform#39405, DEPR
openedx/public-engineering#192), so Studio no
longer has a MATLAB API key setting to warn about.  The platform's own
import and export templates get the same edit in that PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ormsbee

ormsbee commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

FYI @pdpinch, @blarghmatey

@feanil
feanil merged commit 7e3ace3 into openedx:master Nov 25, 2026
42 checks passed
@feanil
feanil deleted the feanil/remove-legacy-xqueue-matlab branch November 25, 2026 02:55
feanil added a commit to feanil/docs.openedx.org that referenced this pull request Nov 25, 2026
The page described a waffle flag that does not exist
(`enable_xqueue_event_bus`), told operators to run an event bus, and
showed problem XML that capa does not accept.  The grader polls the LMS
through the API that edx-submissions serves at `/xqueue/`, and the
result reaches the problem through an in-process openedx-events signal
(`lms/djangoapps/grades/signals/handlers.py`).

Rewrite the page around what master does: the grader account and its
`xqueue` group, the `SINGLE_LOGIN_EXEMPT_GROUPS` exemption the watcher
needs, file storage for `<filesubmission>`, pointing xqueue-watcher at
the LMS with `ContainerGrader` (the base `Grader` raises
NotImplementedError), and what to check when it does not work.

openedx/openedx-platform#39405 removed the
`send_to_submission_course.enable` flag and `XQUEUE_INTERFACE`, so the
page has no flag step.  Verawood setup lives in the migration guide,
since `SINGLE_LOGIN_EXEMPT_GROUPS` only exists on master and Teak and
Ulmo do not serve the `/xqueue/` API.  The URL and the `Enable XQueue`
label are unchanged.  The maintenance chart row is cleared because it
reviewed the old page.

Related: openedx/public-engineering#286
openedx/openedx-platform#39405

Co-Authored-By: Claude Opus 5.5 <[email protected]>
feanil added a commit to feanil/docs.openedx.org that referenced this pull request Nov 25, 2026
openedx/openedx-platform#39405 removes the matlab_api_key field along
with the MATLAB integration
(openedx/public-engineering#192), so the
advanced problem editor no longer has that setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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