Repository navigation
feat(hub): add decision model control plane - #301
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical issues can expose private learning data, break repository isolation, and leave paid training untracked while prematurely releasing credit reservations.
29 open issues
Make queued cancellation conditional on no runtime submission · New Retain reservations until usage or non-execution is confirmed · New Resolve learning text through current eligibility checks · New Reconcile runtime status before applying deadlines · New Do not fail active jobs after settings changes · New Cancel and reconcile training when consent is withdrawn · New Deduplicate runtime submissions durably · New Persist cancellation intent until remote work is reconciled · New Reject redirects for authenticated private-data requests · New Scope runtime promotion state per repository · New Enforce persisted repository visibility in the training API · New Use a PostgreSQL-safe explicit index name · New Persist nonretryable failures to stop recovery retries · New Handle scientific notation in decimal unit conversion · New Reject budgets below the runtime minimum · New Preserve the Hub evaluation ID in responses · New Derive bounded runtime keys from globally unique job IDs · New Return existing requests before checking creation prerequisites · New Preserve configured base URL path prefixes · New Map response-body read errors to transport errors · New
And 9 more that still need to be addressed.
What changed in this PR
Adds Hub’s backend contracts for repository-specific decision-model training, administrator candidate review, promotion, rollback, and saved Build evaluations. Training and model artifacts remain on customer-operated infrastructure. Activation still requires the concrete taskset source.
Changes:
- Adds administrator APIs for settings, training jobs, candidate decisions, and Build evaluation.
- Introduces the runtime client, background processing, persistence, usage accounting, and security audits.
- Adds database migrations, automated coverage, configuration examples, and operating documentation.
| File | Description |
|---|---|
hub/test/database/decision-model-migration/index.db.test.ts |
Adds migration upgrade coverage. |
hub/server/routes/types.ts |
Adds decision-model route dependencies. |
hub/server/routes/index.ts |
Registers decision-model endpoints. |
hub/server/routes/api/security-audits/present-security-audit/index.ts |
Presents decision-model audit details. |
hub/server/routes/api/decision-model/types.ts |
Defines overview and route contracts. |
hub/server/routes/api/decision-model/training-jobs/post/index.ts |
Accepts training requests. |
hub/server/routes/api/decision-model/training-jobs/get/index.ts |
Returns training-job state. |
hub/server/routes/api/decision-model/training-jobs/cancel/post/index.ts |
Exposes training cancellation. |
hub/server/routes/api/decision-model/rollback/post/index.ts |
Exposes generation-checked rollback. |
hub/server/routes/api/decision-model/respond-decision-model-error/index.ts |
Maps domain and runtime errors. |
hub/server/routes/api/decision-model/read-decision-model-session/index.ts |
Restores the requesting session. |
hub/server/routes/api/decision-model/read-administrator/index.ts |
Requires administrator access. |
hub/server/routes/api/decision-model/patch/index.ts |
Validates and saves settings. |
hub/server/routes/api/decision-model/index.test.ts |
Covers access and API presentation. |
hub/server/routes/api/decision-model/get/index.ts |
Returns the repository overview. |
hub/server/routes/api/decision-model/create-decision-model-route-dependencies/index.ts |
Composes API dependencies and projections. |
hub/server/routes/api/decision-model/candidates/rejection/post/index.ts |
Accepts candidate rejection reasons. |
hub/server/routes/api/decision-model/candidates/promotion/post/index.ts |
Exposes candidate promotion. |
hub/server/routes/api/decision-model/builds/evaluation/post/index.ts |
Requests Build evaluation. |
hub/server/repositories/security-audits/parse-security-audit-event/types.ts |
Extends parsed audit types. |
hub/server/repositories/security-audits/parse-security-audit-event/index.ts |
Validates decision-model audit events. |
hub/server/repositories/security-audits/parse-security-audit-event/index.test.ts |
Covers new audit-event types. |
hub/server/repositories/security-audits/get-security-audit-data/index.ts |
Builds stored audit projections. |
hub/server/repositories/security-audits/create-security-audit/types.ts |
Defines decision-model audit contracts. |
hub/server/repositories/decision-training-jobs/update-decision-training-job/index.ts |
Persists conditional state and usage updates. |
hub/server/repositories/decision-training-jobs/sum-decision-training-usage/index.ts |
Aggregates recorded credit usage. |
hub/server/repositories/decision-training-jobs/list-active-decision-training-jobs/index.ts |
Selects jobs for recovery. |
hub/server/repositories/decision-training-jobs/get-decision-training-job/index.ts |
Reads repository-scoped jobs. |
hub/server/repositories/decision-training-jobs/decision-training-jobs.db.test.ts |
Covers reservations and terminal transitions. |
hub/server/repositories/decision-training-jobs/create-or-get-decision-training-job/index.ts |
Creates or reuses keyed requests. |
hub/server/repositories/decision-model-promotions/save-decision-model-promotion/index.ts |
Records promotion history. |
hub/server/repositories/decision-model-promotions/get-decision-model-promotion/index.ts |
Reads the latest promotion. |
hub/server/repositories/decision-model-configurations/save-decision-model-configuration/index.ts |
Saves versioned repository settings. |
hub/server/repositories/decision-model-configurations/get-decision-model-overview/index.ts |
Loads recent control-plane records. |
hub/server/repositories/decision-model-configurations/get-decision-model-configuration/index.ts |
Reads repository settings. |
hub/server/repositories/decision-candidates/save-decision-candidate/index.ts |
Persists immutable candidate evidence. |
hub/server/repositories/decision-candidates/reject-decision-candidate/index.ts |
Records candidate rejection. |
hub/server/repositories/decision-candidates/get-decision-candidate/index.ts |
Looks up repository candidates. |
hub/server/repositories/decision-candidates/decision-candidates.db.test.ts |
Covers metrics, usage, and rejection. |
hub/server/repositories/decision-build-evaluations/save-decision-build-evaluation/index.ts |
Persists Build findings and references. |
hub/server/integrations/postgres/with-decision-model-control-lock/index.ts |
Serializes decision-control operations. |
hub/server/integrations/postgres/with-decision-model-control-lock/index.db.test.ts |
Covers contention and connection loss. |
hub/server/integrations/decision-runtime/create-decision-runtime-client/types.ts |
Defines runtime integration contracts. |
hub/server/integrations/decision-runtime/create-decision-runtime-client/index.ts |
Implements authenticated runtime requests. |
hub/server/integrations/decision-runtime/create-decision-runtime-client/index.test.ts |
Covers requests and response validation. |
hub/server/integrations/decision-runtime/create-decision-runtime-client/errors.ts |
Defines typed runtime failures. |
hub/server/index.ts |
Validates optional runtime configuration. |
hub/server/domains/decision-model/validate-decision-model-settings/index.ts |
Enforces settings bounds. |
hub/server/domains/decision-model/validate-decision-model-settings/index.test.ts |
Covers settings validation boundaries. |
hub/server/domains/decision-model/types.ts |
Defines domain and persistence interfaces. |
hub/server/domains/decision-model/rollback-decision-candidate/index.ts |
Coordinates rollback and persistence. |
hub/server/domains/decision-model/request-decision-training/index.ts |
Prepares and reserves training requests. |
hub/server/domains/decision-model/reject-decision-candidate/index.ts |
Coordinates protected rejection decisions. |
hub/server/domains/decision-model/read-decision-runtime-configuration/index.ts |
Reads runtime connection configuration. |
hub/server/domains/decision-model/promote-decision-candidate/index.ts |
Coordinates generation-checked promotion. |
hub/server/domains/decision-model/process-decision-training-job/index.ts |
Uploads, submits, and polls training. |
hub/server/domains/decision-model/prepare-decision-taskset/index.ts |
Validates and pins preparation inputs. |
hub/server/domains/decision-model/jobs/recover-decision-training.ts |
Defines the recovery schedule. |
hub/server/domains/decision-model/jobs/decision-training.ts |
Defines training payloads and retries. |
hub/server/domains/decision-model/evaluate-build-with-decision-model/index.ts |
Evaluates Builds and saves findings. |
hub/server/domains/decision-model/errors.ts |
Defines control-plane domain errors. |
hub/server/domains/decision-model/create-decision-model-store/index.ts |
Composes transactions, accounting, and audits. |
hub/server/domains/decision-model/create-decision-model-job-processors/index.ts |
Creates training and recovery processors. |
hub/server/domains/decision-model/create-decision-model-job-processors/index.test.ts |
Covers scheduling and polling outcomes. |
hub/server/domains/decision-model/create-current-administrator-decision-authorization/index.ts |
Isolates current administrator authorization. |
hub/server/domains/decision-model/cancel-decision-training/index.ts |
Coordinates cancellation and terminal outcomes. |
hub/server/create-app/index.ts |
Wires dependencies and route-specific parsing. |
hub/schema/repository.prisma |
Adds repository control-plane relations. |
hub/schema/migrations/20261203150000_decision_model_ux_contracts/migration.sql |
Adds metrics, rejection, and usage fields. |
hub/schema/migrations/20261203140000_decision_model_control_plane/migration.sql |
Creates control-plane tables and constraints. |
hub/schema/membership.prisma |
Adds administrator attribution relations. |
hub/schema/decision-training-job.prisma |
Models pinned training jobs. |
hub/schema/decision-training-job-state.enum.prisma |
Defines persisted training states. |
hub/schema/decision-promotion-operation.enum.prisma |
Defines promotion and rollback operations. |
hub/schema/decision-model-promotion.prisma |
Models promotion generations and history. |
hub/schema/decision-model-configuration.prisma |
Models repository opt-in and limits. |
hub/schema/decision-candidate.prisma |
Models candidate evidence and rejection. |
hub/schema/decision-build-evaluation.prisma |
Models saved Build evaluations. |
hub/schema/build.prisma |
Links Builds to evaluations. |
hub/docs/README.md |
Links the control-plane guide. |
hub/docs/decision-model-control-plane.md |
Documents contracts, lifecycle, and activation. |
hub/docs/database.md |
Documents persistence invariants. |
hub/docs/background-jobs.md |
Describes training and recovery jobs. |
hub/docs/architecture.md |
Summarizes the new backend boundary. |
hub/.env.example |
Adds optional runtime configuration examples. |
Review effort: Max (adaptive)
alliscode
force-pushed
the
alliscode-hub-decision-control-plane
branch
2 times, most recently
from
November 19, 2026 20:43
451ea15 to
d21c08f
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
alliscode
force-pushed
the
alliscode-hub-decision-control-plane
branch
from
November 19, 2026 21:24
d21c08f to
d5f57de
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Why
Teams need Hub to coordinate customer-specific decision-model training without moving private screenshots, credentials, or model artifacts into Hub. This adds the backend contract that lets repository administrators opt in, review measured candidates, explicitly promote or reject them, evaluate Builds through the promoted model, and withdraw training data from customer-operated runtimes.
What changes
Hub now prepares and pins training inputs from accepted learnings and Build artifacts, transfers private tasksets to the customer-operated runtime, and uses BullMQ to submit, poll, recover, and cancel bounded training jobs.
PostgreSQL stores repository settings, job and candidate references, held-out metrics, attributed usage and cost, rejection decisions, promotion history, saved Build findings, and content-free runtime copy and deletion receipt references. It does not store runtime credentials, tasksets, screenshots, learning text in findings, adapters, reports, or weights.
The API exposes authoritative preflight coverage, absolute and per-learning candidate metrics, runtime duration and usage, rejection, rollback availability, promotion history, saved findings, and safe withdrawal status. Repository-administrator authority remains behind an explicit seam until broader repository roles are modeled.
The runtime client uses the merged taskset upload, cancellation, hard-credit-budget, authoritative usage, generation-checked promotion, copy disclosure, and deletion receipt contracts. A withdrawal blocks new upload, training, promotion, rollback, and evaluation while Hub reconciles deletion receipts after retries or restart. Activation still needs the concrete taskset source that combines stored Build screenshots with accepted-learning exports and registers these processors in the worker composition.