How Open edX external graders with XQueue and Codejail work
Course teams and platform owners who need code problems graded automatically, while keeping learner code off the LMS host, should understand one division of labor first. XQueue hands each code submission from the LMS to an external grader, and Codejail is the sandbox layer that runs untrusted code safely. The LMS does not execute learner programs itself in this design. It stores the submission, publishes it, and waits for a grader to return a result, so the grading machinery and the sandbox can sit outside the web-facing platform.
The supported path for this flow is the event bus based XQueue submission process that Open edX documents. With the event bus enabled, the LMS stores and publishes the submission, an XQueue watcher consumes it, and the watcher posts the result back through the edx-submissions API. The watcher authenticates as a Django superuser in the xqueue group, so the team must treat its credentials and that group membership as privileged access to plan for. The Tutor plugins index lists an Xqueue plugin by eduNEXT for external grading and a Codejail plugin by eduNEXT for running untrusted code in secure sandboxes. Confirm with the chosen Tutor release that both plugins install cleanly against it, and read the enablement guide for that release before changing any production setting.
What you need before enabling XQueue grading
XQueue grading touches the LMS, the event bus, the watcher and a separate grader host, so most delays come from missing prerequisites rather than from the grading code itself. The cards below cover the release, the platform services, the network paths and the accounts to settle before you change any configuration.
Supported Open edX release
Open edX supports only the latest named release, which is Verawood according to the release notes, so plan the grader setup against that release rather than an older one. Confirm the release your Tutor version targets before you copy any configuration from older guides. A grader that works on one named release can break after an upgrade, so record the release in your change plan.
Release notesTutor deployment baseline
Tutor is the official Docker-based distribution for production and local development, and it is the practical way to manage plugin installation for the Codejail and Xqueue plugins. Confirm that your Tutor version matches the Open edX release you target, and that you can rebuild images and redeploy the LMS and watcher from the same configuration. Keep a record of the exact plugin versions you install.
Tutor docsWorking event bus
The event-bus based flow routes each submission as an event, so the event bus must be enabled and reachable by both the LMS and the watcher before grading works. Decide which event bus backend your team operates and who owns its uptime, retention and access controls. Test publishing and consuming a message end to end before you attach any course content.
Edx-submissions and data stores
The watcher posts results through the edx-submissions API, so the LMS database must hold the submission records. Plan for MySQL 8.0 for the platform database and MongoDB 7.x for the supporting store, and confirm both versions against your release notes before provisioning. Back up both databases before the first graded submission, because grading history lives in them.
edx-platform repositoryShared cache for multi-node setups
A single LMS node can run with local caching, but a multi-node deployment needs a shared Django cache backend such as Redis or Memcached so that every LMS replica sees the same state. Decide which backend you run, size it for your learner load, and confirm it is reachable from every LMS pod or server. Missing shared caching often shows up first as inconsistent grading status between nodes.
Network paths between components
Grading involves three parties that must reach one another: the LMS, the XQueue watcher and the grader host running Codejail. Map each required connection, including the event bus, the database, the cache and the grader endpoint, and enforce it with firewall or network policy. Keep the grader host off general-purpose networks, since it executes learner-submitted code.
Dedicated watcher identity
The watcher authenticates as a Django superuser in the xqueue group, so create a dedicated account for it rather than reusing a person's login or a shared admin. Record who owns the credential, how it is rotated and where it is stored. Keep the watcher's privileges limited to the grading flow, and document the account before go-live.
Admin access and plugin version checks
Someone must hold LMS admin access to configure the external grader entries and verify results, and that access should be assigned to named staff. Before enabling anything, confirm the exact Codejail and Xqueue plugin versions against your Tutor version in the Tutor plugins index, since both plugins are maintained separately from the platform. Record those versions in your change plan so the grader can be rebuilt after an upgrade.
Tutor plugins indexConfiguring the event bus based XQueue flow step by step
This sequence takes an Open edX platform from a standard LMS to one where learner code submissions are routed as events, graded by an external watcher inside a Codejail sandbox, and posted back to the gradebook. Each step closes with a check so the team can confirm the previous layer works before adding the next.
Confirm the event bus is enabled and publishing
Before touching XQueue, the platform team enables the event bus in the Open edX deployment and confirms the LMS publishes events to the broker it uses. Tutor deployments set this through its configuration and plugin settings, so the person running the deployment should check the current Tutor documentation for the exact key names in the release they run. Done means a test event published by the LMS appears on the broker topic that the watcher will later read, and the team can show that message in the broker's own tooling.
Enable XQueue submissions routed as events
The LMS is switched to send XQueue submissions through the event bus rather than the direct HTTP path. The platform owner makes this change in configuration, then restarts the LMS and worker processes so the setting takes effect everywhere. Done means a submission from a test course reaches the LMS submission store with a status of queued, and the broker shows a matching message. If the submission stays in the LMS without a broker message, the team should check the configuration on every LMS replica, not just one.
Deploy the Xqueue plugin for external grading
The team installs the Xqueue plugin by eduNEXT from the Tutor plugins index into the Tutor project, rebuilds the images, and deploys the change. The plugin provides the Xqueue service and the grading hooks that the watcher depends on. Done means the Xqueue service runs in the cluster or Compose stack, its health endpoint responds, and the LMS can reach it on the internal network without exposing it publicly.
Install and configure the Codejail sandbox
Codejail is installed through the Codejail plugin by eduNEXT so that code from learners runs in a restricted sandbox instead of the grader process itself. The team sets the sandbox user, the allowed runtimes and the resource limits in the plugin settings, and confirms the grader process cannot read platform secrets or reach internal services. Done means a deliberately harmless test script runs inside the sandbox and returns output, while an attempt to read a file outside the sandbox directory fails. Record each denied action as evidence for the security review.
Start the XQueue watcher under its service identity
The XQueue watcher is started as its own process. It authenticates as a Django superuser in the xqueue group, so the team should create that account with a strong, rotated credential, store it in the platform secrets manager, and limit who can read it. Done means the watcher starts without authentication errors, logs that it is consuming from the submissions topic, and the account appears only in the expected group. If the watcher cannot authenticate, correct the credential before continuing, since no results will post without it.
Send a test submission through the watcher
A tester creates a course with one graded problem that uses an external grader, then submits a known answer as a learner. The team follows the submission through three places: the LMS record, the broker message, and the watcher log. Done means the watcher log shows the submission being picked up, processed in the Codejail sandbox, and returned with a result. If the log shows the submission but the result is missing, check the sandbox output and the grader response format before moving on.
Confirm the grade posts back through edx-submissions
The final check confirms the watcher wrote the score through the edx-submissions API, which is the path the LMS uses to store scores. The tester opens the instructor gradebook and the learner's progress page for the test problem. Done means the expected score appears in both views, and the edx-submissions record matches it. Repeat the test with a submission that should fail and one that should time out, then keep the results as the acceptance record for the environment.
How a submission moves from the LMS to the grader and back
The flow starts when a learner submits an answer in the LMS, which stores the submission and publishes it to the event bus. An XQueue watcher consumes the event, runs grading, and runs any learner code inside a Codejail sandbox. The watcher then posts the result through the edx-submissions API so the LMS can show the score. Check two points: the watcher's identity, which runs as a Django superuser in the xqueue group, and the boundary between the LMS zone and the grader zone.
Submission flow from the LMS through the event bus and watcher to the results API, with the trust boundary marked.
Which identities and data move between the LMS, watcher and grader
This table maps each hop in an event bus based XQueue submission, from the LMS to the watcher to the grader and back to the score record. Read it by following one submission top to bottom, noting which identity acts at each step and which fields carry learner identifiers. The main takeaway is that the watcher holds elevated rights, so the grader should receive only the code and the grading context it needs.
| Stage | What moves | Identity or access held | Learner data exposed |
|---|---|---|---|
| LMS submission | Learner's code response and submission metadata are stored and published as an event | The learner's authenticated LMS session; the LMS service account writes the record | Learner user identifier and course context are present in the submission record |
| Event topic | Submission event published for the watcher to consume | Event bus producer and consumer credentials; confirm topic access rules in your event bus | Submission identifiers and course context; confirm which fields the event carries in your version |
| XQueue watcher | Consumes the submission and calls the grader | Authenticates as a Django superuser in the xqueue group, so treat it as a privileged identity | Can read the full submission payload, including learner identifiers |
| Grader request | Code and grader configuration sent to the sandbox or external grader | Grader needs no LMS credentials if the watcher passes only the payload it needs | Should carry the code and problem data only; strip or pseudonymize learner identifiers where the grader does not need them |
| Grader response | Score, feedback and status returned to the watcher | Response is returned on the watcher's connection, not as a learner-facing identity | Feedback text may echo learner code or output; review what the grader logs and returns |
| Score record | Result written through the edx-submissions API | Written under the watcher's superuser identity, so audit which actions it may take | Score is tied to the learner's submission and course, which is the record learners and instructors see |
The security boundary for running untrusted learner code
Learner submissions are code you did not write and cannot fully predict, so the grading path has to be designed as a boundary. The cards below cover where execution happens, which identity the watcher uses, how the event bus and logs are controlled, and how the sandbox and grader images are kept current.
Keep execution out of the LMS
The LMS must never execute learner code or run inside the same process, container or network segment as its secrets. Grading should happen in a separate Codejail sandbox reached only through the XQueue path. Ask your team to map which hosts can reach the LMS database, Redis or Memcached, and the signing keys, then confirm that none of them sit on the sandbox side of the boundary.
XQueue setup docsScope the watcher superuser identity
With the event bus enabled, the watcher authenticates as a Django superuser in the xqueue group. That identity is powerful, so treat its credentials as a high-value secret. Confirm which API calls it can make, store its password outside source control, rotate it on a schedule you define, and check whether a narrower role can be used in your release before you accept the default.
Limit watcher network reach
The watcher needs to reach the event bus and the LMS submission API, and little else. Use network policies or firewall rules so the watcher and sandbox cannot open connections to databases, cloud metadata endpoints, internal admin consoles or the public internet unless a documented need exists. Test egress from inside the grader container to confirm the rules hold.
Confirm sandbox isolation and limits
Codejail and the Tutor plugin are the components that run untrusted code, so their isolation model is the thing to verify, not assume. Ask the plugin maintainer which mechanisms it uses, what CPU, memory, time and file limits apply by default, and how they are set. Then run a test suite of hostile submissions (infinite loops, file reads, network calls, fork attempts) and record what each one can reach.
Tutor plugins indexControl event bus access
In the event bus flow, the LMS publishes submissions and the watcher consumes them. Anyone who can publish or read those topics can read learner answers or inject fake grades. Restrict topic permissions to the LMS and the watcher, use separate credentials per service, and review who has administrative access to the broker. Confirm the exact topic names and ACL model in your deployed version.
Log submissions and grader output
Submissions and grader output can contain personal data, and a failed run may expose secrets in stack traces. Decide what is logged, for how long, and who can read it. Redact or truncate learner code in logs where possible, keep grader stderr separate from learner-facing feedback, and make sure logs ship to a store with the same access controls as the LMS.
Patch sandbox and grader images
The sandbox image bundles language runtimes and libraries that carry their own vulnerabilities, so it needs the same patch cadence as the rest of the platform. Pin image versions, rebuild on a schedule and after advisories, rerun the hostile submission suite after each rebuild, and record which image version graded each submission so results can be traced if a flaw is found.
Why submissions stay pending or scores never post
This table lists the failures that most often leave learner submissions pending or stop scores from reaching the gradebook, with the likely cause and the check or fix for each. Work through the rows in order, because the event bus, the watcher and the sandbox each depend on the step before them. Most stuck submissions trace back to the watcher identity, a topic mismatch or a version pairing problem.
| Symptom | Likely cause | Check or fix |
|---|---|---|
| Submissions stay pending indefinitely | The XQueue watcher process is not running, or it crashed after startup | Confirm the watcher container or process is up and read its logs for a startup or connection error. Restart it after fixing the configuration. |
| Watcher connects but cannot post results | The watcher authenticates as the wrong identity, so it lacks the superuser rights in the xqueue group the result post needs | Verify the watcher account is a Django superuser in the xqueue group, as the enablement guide describes. Recreate the account if its group membership is missing. |
| Submissions reach the LMS but no event is consumed | The event bus is disabled in the LMS or the watcher, so submissions are stored without being published | Check the event bus settings on both the LMS and the watcher side. Enable them together and submit a test answer after each change. |
| Events are published but nothing picks them up | Topic name mismatch between the LMS producer and the watcher consumer, often from a renamed environment or a copied configuration | Compare the topic and environment prefix in both configurations character by character. Align them, restart both services, and confirm with one test submission. |
| Submission is consumed but the score never appears | The result posts to an edx-submissions record that does not match the problem, usually because the grader returns a result keyed to the wrong problem or submission | Trace one submission ID through the LMS logs, the watcher logs and the submissions record. Fix the grader's response mapping and retest with a known-good answer. |
| Grading fails only for heavy or slow code | The grader exceeds its time limit, which is set in the grader and the sandbox, so long-running learner code is killed before a result posts | Review the time limit in both places and test with the heaviest expected submission. Raise limits only as far as the course needs, and keep the cap for abusive code. |
| Correct code is marked with a sandbox error | Codejail denies an import or system call the grading script needs, so the run fails before the test cases execute | Read the sandbox denial in the grader logs. Add only the specific modules the assignment requires to the allowed list, and document each addition for the security review. |
| Grader errors appear after an upgrade or plugin change | The Tutor plugin versions for XQueue and Codejail do not match the installed Open edX release, or the event bus code differs from the platform | Check each plugin's compatibility with the named release you run before upgrading. Pin matching versions in your Tutor configuration and retest the full submission path. |
Questions buyers ask about XQueue and Codejail grading
How much effort does XQueue and Codejail grading setup take?
Effort depends on how many grader designs and problem types you need, how strict the sandbox policy must be, and how many nodes the platform runs on. A single grader type on one server is a small, bounded job. Adding several languages, custom test harnesses and a multi-node layout with separate watcher hosts adds design, configuration and testing work at each step. The event bus setup, watcher authentication and sandbox review are the parts that most often take longer than expected. Ask any provider to split its quote by grader design, sandbox policy, watcher deployment and testing so you can see where the effort sits.
How long does it take to set up external graders?
The duration depends on the same drivers as effort: grader count, sandbox policy, deployment layout and how many reviews your security team needs before go-live. Your schedule also depends on how quickly you can provide a test course, sample problems and access to the LMS admin area. Rather than relying on a generic figure, ask for a timeline tied to a written scope with named milestones, including a sandbox review step and a test run with real problem types before any learner submits code.
What does our team need to provide for the project?
You need LMS administrator access to create and configure problems, a named contact from your security team to review the Codejail sandbox policy and the watcher's access, and a set of test problems with known correct and incorrect solutions. Your team also needs to decide which languages learners may submit and what resource limits the sandbox should enforce. Early decisions on these points keep the build from stalling during review.
Can our internal team set up XQueue and Codejail without a partner?
Yes, a team with working knowledge of Tutor, Docker or Kubernetes, and Python can set up external graders, using the Open edX documentation on event bus based XQueue submissions as the reference. The harder parts are the security boundary and operations. Untrusted learner code must run inside the sandbox, the watcher must be authenticated correctly, and results must reach the edx-submissions API reliably. Teams without security review capacity or prior sandbox experience often bring in outside help for the review and testing stages only.
What is the security risk of running untrusted learner code?
The main risk is that a learner's submission escapes the sandbox and reaches the grading host, other learners' data or the platform's credentials. The watcher runs under an account with broad platform rights, so its scope and network reach matter as much as the sandbox itself. Before go-live, ask for a written review of which files, network routes and secrets the sandbox can reach, plus tests that try to break out of it. Keep a record of the review so your compliance team can reference it later.
What recurs after go-live for external graders?
Recurring work includes patching the host operating system, container images and the sandbox, updating the Codejail and Xqueue plugins with each Open edX release, and monitoring the watcher so grading jobs do not queue silently. Each named release has its own upgrade steps, so plan a review of the sandbox and watcher configuration whenever you move to a new release. Confirm with the plugin maintainers which versions match your Tutor version before you schedule an upgrade.
What should a quote for this work include?
A useful quote lists the written scope: the grader types and problem types covered, the sandbox policy to be implemented and reviewed, the watcher deployment layout, the test plan with pass criteria, and the documentation you will receive. It should separate one-time build work from recurring support or upgrade retainers, state what you must provide, and name the milestones and acceptance tests. Ask how the provider handles findings from the sandbox review and whether a retest is included.
How to test grading and sandbox behavior before learners use it
Before any learner submits code, run a written test plan against a disposable copy of the platform that matches production as closely as you can. The first group of cases checks grading accuracy: a set of known-correct submissions that must score full marks, known-incorrect submissions that must score zero or the partial credit your grader defines, and edge cases such as empty files, syntax errors, and very large inputs. Record the expected score for each case before you run it, so that a mismatch is a finding and not a judgment call made after the fact. Confirm with your grader author how timeouts are reported to learners, because a submission that times out should produce a visible, explainable result rather than a silent failure.
The second group tests the sandbox boundary. Submit deliberately hostile code in the disposable environment: attempts to read files outside the submission directory, to write to paths the grader does not own, to open outbound network connections, to spawn processes, and to consume memory or CPU until limits trigger. Codejail is the layer meant to contain this behavior, so confirm with the plugin documentation which limits it enforces in your Tutor version and which are left to the container runtime or network policy. Each attempt should fail in the way you specified, and the attempt itself should appear in logs that your security team can read.
Finally, test the event bus flow under failure. Restart the XQueue watcher while a submission is in progress, then confirm that the submission is neither lost nor graded twice, and that the score written through the edx-submissions API matches what the gradebook shows for that learner. Repeat the check for a learner who resubmits. Keep all results, including failed runs, in a dated record that goes to the security review, and rerun the full suite after every Open edX or plugin upgrade, because grader and sandbox behavior can change between releases.
Choosing between the Tutor plugins and a custom grader
The Tutor plugins index lists an Xqueue plugin by eduNEXT for external grading and a Codejail plugin by eduNEXT for running untrusted code in secure sandboxes. Choosing these plugins means your team inherits a maintained integration instead of writing the grader wiring and sandbox configuration from scratch. The plugins still have to be installed, configured and kept in step with your Tutor version, so the work moves from building to operating.
- Start point: The plugins give you a tested path that matches the Tutor deployment model your team already runs.
- Scope of ownership: Your team owns configuration, secrets, the watcher process and the course-side grader definitions, while the plugin code is maintained upstream.
- Upgrade effort: Each Open edX release may require a plugin version change, so confirm the plugin release that matches your target release before planning an upgrade.
- Code review: Review the plugin source and its sandbox settings yourself, because adopting a plugin does not transfer responsibility for what runs on your servers.
- Support: Ask the plugin maintainer which channel handles security fixes and how quickly sandbox issues are patched.
Confirm the plugin version, its supported Tutor version and its license terms in your own environment before committing to this path.
A custom grader implements the documented XQueue flow directly: with the event bus enabled, the LMS publishes the submission, a watcher consumes it, and the result is posted back through the edx-submissions API. This path suits organizations with grading logic that no plugin covers, such as proprietary languages, domain-specific checkers or specialized feedback formats. It also gives full control over the sandbox, but it moves every design decision and every maintenance task onto your team.
- Fit: Choose it when the grading logic is the differentiator and off-the-shelf graders cannot express it.
- Maintenance: Your team owns the watcher code, its dependencies, its authentication setup as the superuser in the xqueue group, and its logging.
- Upgrade effort: Every named release may change the event bus or API surface the watcher depends on, so budget testing against each target release.
- Code review: Your security team reviews the full execution path, including how submissions reach the sandbox and how results are returned.
- Skills: Confirm your engineers can operate a Django-adjacent event consumer and a sandbox in production before choosing this path.
Specify the grading requirements in writing first, then check whether any existing plugin already meets them.
Ownership decides who answers when a grader fails, a sandbox needs patching or a release upgrade breaks the watcher. With the plugins, responsibility is shared: the maintainer owns the plugin code and your team owns deployment and operation. With a custom grader, your organization owns everything, including the vulnerability response for the sandbox runtime. Put the split in writing before the build or install starts so incidents do not stall on a question of who is responsible.
- Shared model: Plugin path means upstream code plus your configuration, operations and incident response.
- Full model: Custom path means your code, your dependencies, your sandbox and your on-call rota.
- Vendor dependency: Plugins add a dependency on the maintainer's release pace, which you should weigh against your own capacity.
- Exit cost: Moving away from a plugin later means rewriting its wiring, while leaving a custom grader means reworking your own code.
- Documentation: Ask whoever owns each path to document the watcher setup, secrets and recovery steps.
Agree a named owner for the grader, the sandbox and the watcher before the choice is final.
Learner submissions are untrusted input, and the grader executes them or passes them to an execution sandbox. Whichever path you take, the security boundary has to be reviewed by people who can reason about process isolation, filesystem access, network egress and resource limits. Codejail is the sandbox layer in the plugin path, and a custom grader needs an equivalent boundary designed and tested by your team. Reviewers should examine the code that reaches the sandbox, not only the grader's scoring logic.
- Reviewer skills: Assign reviewers who understand sandbox escape risks, not only general application code review.
- Plugin review: Read the plugin source, its sandbox configuration and its dependency list before deployment.
- Custom review: Review the watcher, the submission path, the sandbox boundary and the result handling as one system.
- Testing: Run hostile test submissions against the sandbox, such as infinite loops, large output and attempts to read host files.
- Change control: Require review of every upgrade to the plugin or the watcher, since both touch the execution path.
Ask your security team to sign off on the threat model for untrusted code before any learner submission reaches production.
The right path depends on your situation more than on technical preference. Use the plugins when standard grading covers your courses, your platform team already runs Tutor, and you want to keep the number of custom components small. Build a custom grader when your grading logic is specialized, you have engineers who will own the watcher and sandbox long term, and your review process can cover the full execution path. Many organizations start with the plugins to prove the workflow and move to a custom component only when a specific requirement cannot be met.
- Choose plugins: Standard languages, a Tutor-based platform and limited engineering capacity for grader code.
- Choose custom: Specialized grading logic, a required sandbox design your team must control and long-term ownership capacity.
- Hybrid: Use the plugin for common languages and add a custom grader for the remainder, with clear boundaries between them.
- Cost drivers: Custom work adds build, test and upgrade effort each release, while plugin work adds configuration and review effort.
- Quote request: Ask for the effort split between initial build, release upgrades and security review in any proposal.
Write down the grading requirements, then test them against the plugin documentation before deciding.
How DeployOpen scopes and supports XQueue and Codejail grading
DeployOpen plans, builds, documents and supports external grading for Open edX inside your own infrastructure. The work starts with a written scope that defines which graders, sandboxes and learner submissions are in play, and it hands the running setup to your team with the controls and documentation your reviewers need.
How we scope
- Inventory the course types, programming languages and grader logic that will run through XQueue before any build starts.
- Agree in writing which Codejail sandbox and eduNEXT plugin configuration is in scope for your Tutor deployment.
- Define the security boundary for untrusted learner code, including which hosts, networks and data the grader may reach.
- Confirm the event bus, watcher placement and Open edX release your platform runs, since the setup depends on them.
How we build
- Enable event bus based XQueue submissions and confirm the LMS stores, publishes and receives grading results as designed.
- Deploy XQueue watchers with the superuser and xqueue group access settings reviewed against your least-privilege policy.
- Configure Codejail sandboxes and test them with hostile and malformed submissions before learners reach them.
- Run the grading flow end to end in a non-production Tutor environment and record each test result for your review.
How we hand over
- Deliver written configuration, architecture notes and the security boundary description so your team can review them independently.
- Document the watcher restart, log locations and failure symptoms your course operators will need day to day.
- Walk your platform, security and course teams through the grading flow and the known limits of sandboxed execution.
- Provide a findings and retest record covering sandbox escape attempts, credential exposure and resource abuse tests.
How we support
- Support is available as a retainer for watcher upgrades, Codejail updates and changes after each named Open edX release.
- Retainers can include repeat sandbox testing when new course content or grader languages are added to the platform.
- Ask any partner for a quote tied to a written scope, including who maintains the sandbox host and who answers grading incidents.
- Confirm with your own security team whether independent testing or an audit is needed, since DeployOpen does not issue audit reports.

