fix(server): unify session workspace root (#266)

This commit is contained in:
kami
2026-07-21 01:48:45 +04:00
parent ae0b23df3f
commit a2bf976a13
17 changed files with 55 additions and 75 deletions
@@ -679,7 +679,6 @@ object ConfigLoader {
val projectSection = sections["project"] ?: emptyMap()
val project = ProjectConfig(
enabled = asBoolean(projectSection["enabled"], false),
root = asString(projectSection["root"], ""),
memoryK = asInt(projectSection["memory_k"], DEFAULT_PROJECT_MEMORY_K),
maxDepth = asInt(projectSection["max_depth"], DEFAULT_PROJECT_MAX_DEPTH),
ignoreGlobs = asStringList(projectSection["ignore_globs"]).ifEmpty { ProjectConfig.DEFAULT_IGNORES },
@@ -146,12 +146,11 @@ data class PersonalizationConfig(
/**
* Project-scoped, cross-session memory. When [enabled], the decision journal is distilled
* to durable per-repo memory at session end and retrieved (top-[memoryK]) at session start.
* [root] is the repo root key; empty means the current working directory.
* The repository key is always the session's recorded bound workspace, never configuration.
*/
@Serializable
data class ProjectConfig(
val enabled: Boolean = false,
val root: String = "",
val memoryK: Int = 5,
val maxDepth: Int = 4,
val ignoreGlobs: List<String> = DEFAULT_IGNORES,
@@ -122,7 +122,6 @@ object CorrexConfigWriter {
b.section("project")
b.kv("enabled", cfg.project.enabled)
b.kv("root", str(cfg.project.root))
b.kv("memory_k", cfg.project.memoryK)
b.kv("max_depth", cfg.project.maxDepth)
b.kv("inject_top_k", cfg.project.injectTopK)
@@ -189,7 +189,6 @@ class ConfigLoaderTest {
val toml = """
[project]
enabled = true
root = "/home/me/repo"
memory_k = 8
""".trimIndent()
@@ -199,7 +198,6 @@ class ConfigLoaderTest {
val result = parseTomlMethod.invoke(ConfigLoader, toml) as CorrexConfig
assertEquals(true, result.project.enabled)
assertEquals("/home/me/repo", result.project.root)
assertEquals(8, result.project.memoryK)
}
@@ -216,7 +214,6 @@ class ConfigLoaderTest {
val result = parseTomlMethod.invoke(ConfigLoader, toml) as CorrexConfig
assertEquals(false, result.project.enabled)
assertEquals("", result.project.root)
assertEquals(5, result.project.memoryK)
}
@@ -36,7 +36,7 @@ class CorrexConfigWriterTest {
narration = NarrationSettings(temperature = 0.1, topP = 0.95, maxTokens = 256, maxPerRun = 3),
),
personalization = PersonalizationConfig(enabled = true, learn = true),
project = ProjectConfig(enabled = true, root = "/repo", memoryK = 8, maxDepth = 6, injectTopK = 40),
project = ProjectConfig(enabled = true, memoryK = 8, maxDepth = 6, injectTopK = 40),
git = GitConfig(enabled = true, remote = "gitea", baseBranch = "develop", author = "Correx <bot@example.test>"),
modelsSettings = ModelsSettings(defaultModel = "m1", host = "0.0.0.0", port = 10001),
orchestration = OrchestrationKnobs(stageTimeoutMs = 90_000, journalCompactionTokenThreshold = 12_000),