feat(config): relocate orchestration loop/threshold/budget constants to [orchestration] config

The kernel's ReAct-loop tuning constants (max tool rounds, read/rejection-loop
nudge thresholds, feedback issue cap, repo-map top-k/files-per-dir, docs catalog
cap, clarification-round cap, review-block confidence/retry cap, default
refinement, recovery/intent route budgets) were hardcoded in SessionOrchestrator/
DefaultSessionOrchestrator. Relocated to a new OrchestrationTuning value threaded
through the orchestrator constructor, mapped from CorrexConfig.orchestration in
Main.kt, parsed in ConfigLoader, written by CorrexConfigWriter. Defaults equal the
former constants so an absent [orchestration] section reproduces prior behavior.

Startup-load (not hot-reload); pure output-truncation caps left as constants.

Vikunja #46 (task 76).
This commit is contained in:
2026-07-12 17:45:54 +04:00
parent 8d7c827ebb
commit b2c7bbe401
7 changed files with 139 additions and 33 deletions
@@ -34,6 +34,7 @@ import com.correx.core.inference.ModelCapability
import com.correx.core.kernel.orchestration.DefaultOrchestrationReducer
import com.correx.core.kernel.orchestration.DefaultSessionOrchestrator
import com.correx.core.kernel.orchestration.OrchestrationConfig
import com.correx.core.kernel.orchestration.OrchestrationTuning
import com.correx.core.kernel.orchestration.OrchestrationProjector
import com.correx.core.kernel.orchestration.OrchestrationRepository
import com.correx.core.kernel.orchestration.OrchestratorEngines
@@ -389,6 +390,27 @@ fun main() {
toolRegistry.all().map { it.name }.toSet(),
injectRecovery = true,
)
// Startup-load orchestration tuning from the [orchestration] config section into the kernel's
// OrchestrationTuning. ponytail: read once at boot — a config edit needs a restart to take effect
// (unlike stage_timeout_ms, which ServerModule re-reads per session). Add a supplier if these ever
// need hot-reload.
val orchestrationTuning = with(correxConfig.orchestration) {
OrchestrationTuning(
maxToolRounds = maxToolRounds,
readLoopNudgeThreshold = readLoopNudgeThreshold,
rejectionLoopNudgeThreshold = rejectionLoopNudgeThreshold,
maxFeedbackIssues = maxFeedbackIssues,
repoMapInjectTopK = repoMapInjectTopK,
repoMapFilesPerDir = repoMapFilesPerDir,
docsCatalogMax = docsCatalogMax,
maxClarificationRounds = maxClarificationRounds,
reviewBlockMinConfidence = reviewBlockMinConfidence,
reviewBlockRetryCap = reviewBlockRetryCap,
defaultMaxRefinement = defaultMaxRefinement,
recoveryRouteBudget = recoveryRouteBudget,
intentRouteBudget = intentRouteBudget,
)
}
val orchestrator = DefaultSessionOrchestrator(
repositories = repositories,
engines = engines.copy(
@@ -424,6 +446,7 @@ fun main() {
taskSessionResolver,
),
),
tuning = orchestrationTuning,
)
val workflowRegistry = FileSystemWorkflowRegistry(
InfrastructureModule.createWorkflowLoader(configArtifactKindsEarly),