Generation State Machine Revamp#9
Open
gael55x wants to merge 14 commits into
Open
Conversation
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.
Generation State Machine Revamp
This PR describes the persistent activity-generation state machine refactor used by Codemm.
Goals
runId, not by thread alone.Aggregates
Thread Aggregate
User-facing lifecycle:
DRAFTCLARIFYINGREADYGENERATE_PENDINGGENERATINGCOMPLETEDPARTIAL_SUCCESSRETRYABLE_FAILUREHARD_FAILURERules:
GENERATE_PENDINGmeans the request has been accepted but slot execution has not started.GENERATINGmeans there is an active persisted generation run in progress.Generation Run Aggregate
Persistent run lifecycle:
PENDINGRUNNINGCOMPLETEDPARTIAL_SUCCESSRETRYABLE_FAILUREHARD_FAILUREABORTEDSource of truth:
generation_runsImportant fields:
idthread_idstatusactivity_idtotal_slotscompleted_slotssuccessful_slotsfailed_slotslast_failure_kindlast_failure_codelast_failure_messagestarted_atfinished_atSlot Aggregate
Persistent slot-stage lifecycle:
QUEUEDSKELETON_RUNNINGTESTS_RUNNINGREFERENCE_RUNNINGVALIDATING_REFERENCEREPAIRING_REFERENCEVALIDATING_REPAIRSUCCEEDEDRETRYABLE_FAILUREHARD_FAILURESKIPPEDSource of truth:
generation_slot_runsgeneration_slot_transitionsImportant fields:
run_idslot_indexstatuscurrent_stageattempt_countstarted_atended_atlast_failure_kindlast_failure_codelast_failure_messagelast_artifact_hashTransition Model
Normal Flow
READYaccepts a generation request.GENERATE_PENDING.generation_runsrow is created inPENDING.generation_slot_runsasQUEUED.RUNNING.GENERATING.Terminal Run Derivation
SUCCEEDED->COMPLETEDSUCCEEDEDand failures/skips ->PARTIAL_SUCCESSRETRYABLE_FAILUREHARD_FAILUREFailure Isolation
Run-Scoped Progress
runId.runId.runs+run_eventsfor the requestedrunId.runId.Crash Recovery
Startup reconciliation runs during engine boot:
generation_runsinPENDINGorRUNNING.QUEUED->SKIPPEDRETRYABLE_FAILUREGENERATE_PENDING/GENERATINGthread states even if the latest run is missing.This prevents the database from remaining permanently inconsistent after crashes.
Judge Integration
Reference validation now consumes structured judge outcomes:
COMPILE_ERRORTEST_FAILUREEXEC_TIMEOUTOUTPUT_LIMITINFRA_ERRORJudge containers are launched with:
Java judging now compiles into
/tmp/classesso/workspacecan remain read-only.Current Migration Notes
runsandrun_eventsremain for diagnostics and replay compatibility.generation_runs,generation_slot_runs, andgeneration_slot_transitionsare now the execution source of truth.