Skip to content

feat!: remove the legacy XQueue HTTP path and the MATLAB integration - #338

Merged
feanil merged 2 commits into
openedx:mainfrom
feanil:feanil/remove-legacy-xqueue-matlab
Nov 24, 2026
Merged

feanil merged 2 commits into
openedx:mainfrom
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 and serves the API that xqueue-watcher polls, and scores come back through the EXTERNAL_GRADER_SCORE_SUBMITTED signal. This removes the code that only existed for the old service, and the MATLAB integration that only worked through it (openedx/public-engineering#192).

XQueue

  • XQueueInterface no longer posts to the XQueue service over HTTP. The login round trip, the request timeouts, parse_xreply and the use_submission_service switch are gone. It now takes the block and hands every submission to XQueueInterfaceSubmission.
  • make_xheader no longer takes lms_callback_url. Nothing calls back any more.
  • The runtime's xqueue service no longer needs construct_callback.

MATLAB

  • MatlabInput, its template, fixture and CodeMirror octave mode, and the sanitize_html helper only it used are gone.
  • matlab_api_key is gone from ProblemBlock and LoncapaSystem, and CodeResponse no longer adds the API key to the grader payload.
  • The ungraded_response handlers that carried MATLAB's plot output are gone.
  • <matlabinput> stays as a tag on CodeInput, so existing problems still parse and learners keep their scores. It renders as a plain code box.

Both commits are feat!, so this releases as a major version. openedx-platform needs a matching change for the new XQueueInterface signature and the dropped LoncapaSystem argument: openedx/openedx-platform#39405. The pin bump and that PR have to land together, since dropping matlab_api_key from the non-editable list here makes the field editable again in Studio on a platform that still has it on the inheritance mixin.

The Python suite passes locally (836 tests). The JS spec that covered polling on a queued problem now uses a codeinput fixture instead of the MATLAB one.

return default


def sanitize_html(html_code):

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.

MatlabInput was the onlything using this so it and its tests can be removed.

@feanil
feanil force-pushed the feanil/remove-legacy-xqueue-matlab branch from 2eb406f to 9e40e5e Compare November 20, 2026 20:19
@feanil
feanil marked this pull request as ready for review November 20, 2026 20:19

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

Thank you for taking this on. I should have done this a while ago.

I have a few relatively small requests, and a couple of non-blocking questions that can be done as follow-ups.

@blarghmatey: Would you or someone from your team be available to help test this PR once it gets to an approved state? Would you like to review it before it merges?


Claude usage details

Claude drafted this review and ran these on 9e40e5e:

  • Python suite (pytest src on Python 3.13, Django 5.2, SQLite): 839 passed.
  • Throwaway tests on a <coderesponse> problem, with the stub service's XQueueInterface pointed at the real block. Not in the branch.
    • Nothing mocked, once with <textbox> and once with <matlabinput>: one pending ExternalGraderDetail each, with the problem's queue name and queue key.
    • SubmissionSerializer.save patched to raise DatabaseError: see the inline comment on return 1, str(err).
    • An answer one byte over 100 KB: see the same comment.
    • max_attempts=1 with send_to_submission raising SubmissionInternalError: attempts == 1 and the problem is closed.
    • max_attempts=1 with send_to_queue raising ResponseError: attempts == 0 and the problem is open.
  • The max_attempts=1 test on main (4f034a4), not in any branch.
    • use_submission_service=True and send_to_submission raising: submit_problem raises, attempts == 0.
    • use_submission_service=False and _http_post returning (1, "cannot connect to server"): attempts == 1 and the problem is closed.
  • Read edx-submissions 4.1.0 (the version in uv.lock) for its exception messages, and the diff of openedx/openedx-platform#39405 for the calling side. Nothing was run against either.

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

Comment on lines +6 to +9
The header built here is an internal envelope: edx-submissions reads the
queue name and the queue key out of it and builds its own header for the
grader. The queue key format is the one the retired XQueue service used,
since the problem's correct map still stores it.

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.

[Comment, no action needed]: With one backend left, the header is a dict that we serialize to JSON so that send_to_queue() and get_submission_params() can each parse it again to pull one value out. I'd like to see XQueueInterface and XQueueInterfaceSubmission collapse into one class that takes the queue name and key as plain arguments, but that should be its own PR.

Comment thread src/xblock_problem/capa/inputtypes.py Resolved
Comment thread src/xblock_problem/tests/__init__.py Resolved
@feanil
feanil force-pushed the feanil/remove-legacy-xqueue-matlab branch from 9e40e5e to 1c5813e Compare November 23, 2026 15:32

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

Thank you for the quick turnaround. This takes care of everything from the last round, and I don't see anything blocking.

I have one request, which is to fix the comment in get_score() about what gets saved when the hand-off fails (inline). The other two comments are nits.

Once that's in, this is good for squashing. Please update the two commit bodies when you do, since they still describe the first version: send_to_queue() passing the exception's message along, and <matlabinput> only rendering as a code box.


Claude usage details

Claude drafted this review and ran these on 0a6e959:

  • Python suite (pytest src on Python 3.13, Django 5.2, SQLite): 860 passed.
  • git range-diff of the two rebased commits against the ones reviewed last time (20e505f, 9e40e5e): the second is unchanged, and the first differs only in lines that it deletes.
  • Throwaway tests on a <coderesponse> problem, with the stub service's XQueueInterface pointed at the real block. Not in the branch.
    • SubmissionSerializer.save patched to raise DatabaseError, with <img src=x onerror=alert(1)> as the answer and max_attempts=1: the response is the fixed "the grading queue is unavailable" message, attempts == 0, the problem is open, and the log.exception record has a traceback.
    • The same as a staff user: the "Staff debug info" traceback has the ResponseError and nothing from the DatabaseError.
    • An answer one byte over 100 KB, nothing mocked: see the inline comment on "the submission was rejected".
    • <matlabinput> with max_attempts=1, nothing mocked: "MATLAB problems can no longer be graded.", no Submission or ExternalGraderDetail rows, attempts == 0, and the problem is open.
    • A queued submission followed by a failed one, and a problem with two <coderesponse>s: see the inline comment in get_score().
  • Read display.js for how the message gets onto the page. Nothing was run in a browser.

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

Comment on lines +2725 to +2727
# Raising here, rather than returning an error correct map, keeps the failed
# hand-off from counting as an attempt: submit_problem catches ResponseError,
# shows the message and leaves the attempt count and the saved state alone.

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.

submit_problem does save state on this path, in the except block that catches this. What it skips is counting the attempt and replacing the correct map. Claude ran two throwaway tests to see what that leaves behind:

  • A first submission is queued, and then a second one fails here. The second answer is saved next to the first one's queue state, so when the first reply arrives, its result lands beside code that was never queued.
  • A problem with two <coderesponse>s, where the second answer is over the size limit. The first is left pending in edx-submissions, and since its queue key isn't in the correct map, update_score() won't use the reply.

I think both are fine for a failure case, and the first is what every ResponseError does already. But could you please update this comment to say what does get saved and mention those two cases, so that it's clear we accepted them on purpose?

Comment on lines +86 to +88
# The message goes in front of the learner, and codeinput.html renders it unescaped,
# so it is a fixed string: the exception text can carry the learner's own answer.
# The details go to the log.

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.

Nit: Since the ResponseError change, this message doesn't get as far as codeinput.html. It goes back in the problem_check response, and gentle_alert() puts it on the page as HTML, so the reasoning still holds. The docstring on test_send_to_queue_reports_exceptions_as_errors mentions codeinput.html as well.

Suggested change
# The message goes in front of the learner, and codeinput.html renders it unescaped,
# so it is a fixed string: the exception text can carry the learner's own answer.
# The details go to the log.
# The message goes in front of the learner, and display.js shows it as HTML (see
# gentle_alert()), so it is a fixed string: the exception text can carry the
# learner's own answer. The details go to the log.

result = self.submission.send_to_submission(header, body, queue_key, files)
except SubmissionRequestError:
log.exception("Submission for %s was rejected by edx-submissions", self.block.usage_key)
return 1, "the submission was rejected"

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.

Nit (optional): Claude ran an answer that's over the size limit through with nothing mocked, and the learner gets "Unable to deliver your submission to grader (Reason: the submission was rejected). Please try again later." Trying again later isn't going to help them. Neither reason is translated either, though that was also true of "cannot connect to server" on the HTTP path.

It might be simpler for get_score() to own the whole sentence for each case, but I'm fine with leaving that for the follow-up PR that collapses these classes.

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.

I created #345 to follow up and do the full collapse.

@feanil
feanil requested review from ormsbee and removed request for kdmccormick and ormsbee November 24, 2026 13:38
feanil and others added 2 commits November 24, 2026 08:41
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: the service is deprecated and its repo archived
(openedx/public-engineering#286), and the LMS
now queues submissions in edx-submissions, which has no callback.
openedx/public-engineering#192 deprecated the
MATLAB handling in 2023 because the endpoint it talked to no longer
worked.

Remove MatlabInput, its template, fixture and CodeMirror octave mode, the
sanitize_html helper only it used, the matlab_api_key field on
ProblemBlock and LoncapaSystem, the API key payload in CodeResponse, and
the ungraded_response handlers that carried MATLAB's plot output.

<matlabinput> stays as a tag on CodeInput so existing problems still
parse and learners keep their scores.  It renders as a plain code box.
CodeResponse refuses a new submission on it with "MATLAB problems can no
longer be graded." instead of queueing it where no grader will pick it
up, and the learner does not use an attempt.

BREAKING CHANGE: LoncapaSystem no longer accepts matlab_api_key, and
ProblemBlock no longer has that field or the ungraded_response handler.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
XQueueInterface could still post to the XQueue service over HTTP when the
send_to_submission_course.enable flag was off for a course, with a login
round trip, request timeouts and reply parsing to go with it.  The XQueue
service is deprecated and its repo archived
(openedx/public-engineering#286), and
edx-submissions is the only queue the LMS serves, so the HTTP path goes.

XQueueInterface now takes the block and hands every submission to
XQueueInterfaceSubmission.  The header no longer carries a callback URL:
scores come back through the EXTERNAL_GRADER_SCORE_SUBMITTED signal, not
an HTTP callback.  The header is an internal envelope now; edx-submissions
reads the queue name and the queue key out of it and builds its own
header for the grader.

send_to_queue reports a failure inside edx-submissions as an error code
and a fixed message, "the grading queue is unavailable", or "the
submission was rejected" for a request edx-submissions refuses.  The
exception text can carry the learner's own answer and the message is
shown as HTML, so the details only go to the log, with the traceback.
It returns 0 on success, as the HTTP path did, where the edx-submissions
path returned None.

When the hand-off fails, CodeResponse.get_score raises a ResponseError
instead of returning an error correct map.  submit_problem shows the
message and does not count the attempt, so a learner on their last
attempt is not locked out by a submission that was never queued.

BREAKING CHANGE: XQueueInterface(url, django_auth, requests_auth, block,
use_submission_service) is now XQueueInterface(block).  make_xheader no
longer takes lms_callback_url.  The runtime's xqueue service no longer
needs construct_callback.  A failed hand-off in CodeResponse now raises
ResponseError rather than returning a correct map with the error message.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@feanil
feanil force-pushed the feanil/remove-legacy-xqueue-matlab branch from 0a6e959 to 3a99862 Compare November 24, 2026 13:42
@feanil
feanil merged commit df67a94 into openedx:main Nov 24, 2026
8 of 9 checks passed
feanil added a commit to feanil/openedx-platform that referenced this pull request Nov 24, 2026
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; the value is dropped.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
feanil added a commit to feanil/openedx-platform that referenced this pull request Nov 24, 2026
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.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
feanil added a commit to feanil/openedx-platform that referenced this pull request Nov 24, 2026
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]>
feanil added a commit to feanil/openedx-platform that referenced this pull request Nov 24, 2026
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 added a commit to feanil/openedx-platform that referenced this pull request Nov 24, 2026
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]>
feanil added a commit to feanil/openedx-platform that referenced this pull request Nov 24, 2026
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]>
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