Skip to content

Responsibilities and dependencies

This is the one current map of who owns what. It describes the code as implemented; the integration contracts are the normative versions of each boundary, and this page links to them instead of repeating their schemas.

Dependency direction

 web/  (HTTP host)          github_action/  (Actions host)
   │  configs, jobs,           │  repository files, artifact,
   │  persistence, delivery    │  optional cloud publication
   └──────────────┬────────────┘
                  ▼
         execution_host/   composes HostCapabilities:
                  │        DockerHost / DockerSession, S3FixtureProvider,
                  │        ConfiguredAssessmentProvider (OpenAI)
                  ▼
         sandbox_manager/  container leases, run_process, private control API
                  │
                  ▼
           autograder/     core: contracts, compilation, assessment, grading,
                           feedback. Imports none of the packages above.

Arrows point from a package to what it may import. Every layer may import the core; the core receives hosts only as values in HostCapabilities. tests/unit/test_architecture.py enforces exactly these directions (core imports no host package, sandbox_manager no host, execution_host no web/Actions code) plus a runtime check that importing every core module loads no host or provider SDK. It does not prescribe classes or folders.

Core (autograder/)

Responsibility Where Contract
Versioned definition, normalization, immutable compiled definition (compile_definition, compile_snapshot) models/contracts/definition.py DEFINITIONS.md
Evaluator contract: TestFunction/AiTestFunction, parameter contracts derived from execute, validate_parameters, accepts_file; trusted Template registries models/abstract/, models/contracts/parameter_contract.py CATALOG.md, Adding an evaluator
Discovery (describe_templates) read from the same registry models/contracts/catalog.py CATALOG.md
Built-in evaluators and their registry template_library/ (BUILTIN_TEMPLATES) Evaluator reference
Language identity (the only language list) models/language.py LANGUAGES.md
Submission input and evaluator file selection models/dataclass/submission.py, services/file_selection.py SUBMISSIONS.md, FILES.md
Host capability protocols: ExecutionSession (run_process), ServerSession, AssessmentProvider, fixture reference -> bytes models/capabilities.py, models/execution.py, models/process.py CAPABILITIES.md, PROCESSES.md
Run order: bind language, validate, acquire/prepare a session, assess, grade, requested feedback, close, finalize autograder.py (AutograderPipeline.run), services/preparation.py Run order
Assessment: ordinary evaluators one by one, all AI criteria in one provider batch, results keyed by criterion ID services/assessment.py DECISIONS.md
Result model and scoring: frozen ResultOutcomeTree built once; one scoring definition; definition-vs-outcome verification services/grading.py, models/contracts/scoring.py, models/contracts/verification.py Scores, OUTCOMES.md
Requested feedback (focus ranking + the default report) services/feedback.py, services/focus_service.py, services/report/ Student feedback
Baseline comparison: pure compare_outcomes over two completed canonical outcomes and their bound definitions, joined by criterion ID; never a grading stage models/contracts/comparison.py Baseline Comparison
Terminal outcome v1 and the facade (evaluate_submission, build_pipeline) models/contracts/outcome.py, facade.py OUTCOMES.md

The core never imports Docker, S3, OpenAI, HTTP frameworks or databases, never interprets platform identities or database IDs, and keeps no process globals for hosts. Diagnostics are optional observations, never data for later operations (diagnostics).

Run order

AutograderPipeline.run (autograder/autograder.py) is the whole runtime order, as ordinary calls passing local values:

  1. Bind the submission language and derive requirements from the selected criteria and that language's preparation.
  2. Validate required files and every criterion's file selection, before any provider or session is touched.
  3. Acquire a session only when a selected criterion or the preparation needs one; stage files and fixtures and run the setup commands (services/preparation.py).
  4. assess_criteria (services/assessment.py): ordinary evaluators run one by one, each with a fresh copy of its frozen parameters; every selected AI criterion goes to assess_many, one AssessmentProvider.assess call keyed by criterion ID.
  5. grade(criteria, results) (services/grading.py) builds the frozen ResultOutcomeTree once; verify_outcome_tree checks it against the definition, as it checks externally attested trees.
  6. Only with feedback.enabled: render_feedback(tree, preferences, locale) ranks criteria by points lost (find_focus) and renders the default report. A failure here keeps the grade and marks feedback failed.
  7. Close the owned session in finally, then build the terminal outcome.

Compilation supplies templates, normalized parameters and the criteria tree; runtime never reloads them. A required failure returns a failed outcome with null score and tree.

Scoring

models/contracts/scoring.py is the only implementation of traversal, effective weights and score arithmetic; grading, outcome validation, verification, focus and comparison all call it. Traversal is base, bonus, penalty and, inside a holder, nested subjects before direct tests; assessment runs in that order. The rules themselves are described once, for authors, in Scores. Derived views (score_vector, find_focus, compare_outcomes) are keyed by criterion ID, never by display name.

Diagnostics

run and evaluate_submission accept an optional observer callback. It receives frozen DiagnosticEvents (execution ID, operation, status, optional safe error) with no submission, tree, session or grade, and the coordinator never reads them back. Observer exceptions are logged and change nothing. Cleanup failures reach logging and the observer as close_session / CLEANUP_ERROR without replacing the outcome.

Execution infrastructure (sandbox_manager/)

Owns Docker containers: pools keyed by the domain Language; one owner from get_sandbox(language) to dispose(sandbox), which forgets a sandbox only after Docker confirms removal (a failed removal is quarantined: still tracked, counted against capacity and retried with backoff); used sandboxes are never returned to a pool. Containers carry owner-lease labels, startup reclaims only provably dead owners, and operators use python -m sandbox_manager.reclaim for the rest. It also owns the single Docker profile and limits, run_process with exact stdin and confirmed termination, artifact readback, and the private bearer-authenticated control API (one worker) with its remote client. Language-to-image mapping is host configuration (sandbox_config.yml runtimes:). See SANDBOX.md, PROCESSES.md and Sandbox Manager Internals.

Host composition (execution_host/)

Builds the HostCapabilities a host passes to the core: DockerHost (the HTTP host's local or remote manager, one DockerSession per run), RunnerHost (the Action's single on-demand sandbox on the runner's Docker), S3FixtureProvider (uncached reference -> bytes, FixtureNotFound for a missing key) and ConfiguredAssessmentProvider (OpenAI, configured from the environment; one lazily built client per host with a 180 s request deadline and no SDK retries). A new host or provider is a new value here or in a host, not a core change. collect_files (submission_files.py) reads a directory as a submission for the Action and for the author's check, python -m execution_host.check (check.py): compile_definition, then evaluate_submission of reference directories with a RunnerHost, and no grading logic of its own (Test your rubric).

Hosts (web/, github_action/)

Hosts collect files, authenticate, choose the definition identity and revision, accept and schedule work, persist or publish the finalized outcome, and retry delivery without grading again.

  • HTTP (web/): one bearer-token trust boundary for every non-public route (integration and per-producer attestation principals, AUTH.md); configuration resources with revisions and conditional PATCH; durable PostgreSQL submission jobs with leased workers and outcome receipts (JOBS.md); replay-safe acceptance and attestation through Idempotency-Key (REPLAY.md); polling and authenticated details; external result attestation (verified with the same verify_outcome_tree as local grades); the read-only baseline comparison route; and bounded deliberate execution. See Web Module, API.md and Deliberate Execution.
  • GitHub Actions (github_action/): compiles the repository definition (or reloads the selected cloud revision's snapshot), grades with a RunnerHost (one sandbox of the selected language on the runner's Docker, only when the definition executes code), saves the canonical artifact, then optionally publishes it as an attestation. Submitter, actor and producer identities stay separate and runner trust is enforced (Identity and Trust). See GitHub Action.

Current behavior and plans

Everything above is implemented and tested. The following are not implemented and must not be described as current behavior:

  • No shipped host supplies server_execution; API-testing criteria fail with SERVER_CAPABILITY_UNAVAILABLE.
  • Durable jobs are claimed in submission order by a fixed worker count; there is no priority, fairness or quota scheduling policy.
  • Sandbox handles of the control API live in one process; there is no shared handle store or distributed sandbox provisioning.
  • Feedback has one mode (default); there is no AI report mode.
  • Fixtures are not cached; any future cache must meet the identity and invalidation rules in CAPABILITIES.md.