Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(cli): identify in-place runs in disk usage (#11015)
Danila Katalshov16f7c7536cc8
diff --git a/apps/docs/content/docs/daemon-runtimes.fr.mdx b/apps/docs/content/docs/daemon-runtimes.fr.mdxindex d63320f77d..296907b5de 100644--- a/apps/docs/content/docs/daemon-runtimes.fr.mdx+++ b/apps/docs/content/docs/daemon-runtimes.fr.mdx@@ -162,6 +162,8 @@ La connexion s'applique à partir de l'exécution suivante de l'agent ; l'exécuLe daemon fait un premier nettoyage environ 30 secondes après son démarrage, puis toutes les 2 heures. Les répertoires utilisés par une exécution en cours ne sont jamais nettoyés. `multica daemon disk-usage` affiche l'occupation par espace de travail ou par exécution. Les durées ci-dessous sont les valeurs par défaut ; les variables `MULTICA_GC_*` correspondantes figurent dans [Variables d'environnement](/environment-variables#gc).+La colonne `MODE` du tableau par exécution indique les exécutions sur place avec `in place`. Dans la sortie JSON, les lignes correspondantes portent `local_directory: true` lorsque les métadonnées indiquent ce mode.+### Répertoires des exécutionsChaque exécution a un répertoire sous la racine des espaces de travail (par défaut `~/multica_workspaces`) contenant le code récupéré, les sorties et les journaux ; les exécutions suivantes sur la même tâche le réutilisent.diff --git a/apps/docs/content/docs/daemon-runtimes.ja.mdx b/apps/docs/content/docs/daemon-runtimes.ja.mdxindex 8b68d2f432..cef156c4ef 100644--- a/apps/docs/content/docs/daemon-runtimes.ja.mdx+++ b/apps/docs/content/docs/daemon-runtimes.ja.mdx@@ -162,6 +162,8 @@ cd ~/.multica/cursor-mcp-auth/<agent-id>/user-login/workdir && CURSOR_DATA_DIR=~デーモンは起動の約 30 秒後に最初のクリーンアップを行い、その後は 2 時間ごとに行います。実行中の実行が使っているディレクトリは削除されません。`multica daemon disk-usage` でワークスペースごと、実行ごとの使用量を確認できます。以下の期間はデフォルト値で、対応する `MULTICA_GC_*` 変数は[環境変数](/environment-variables#gc)にあります。+実行ごとの表では、直接実行を `MODE` 列に `in place` と表示します。メタデータでこのモードを確認できる行には、JSON 出力に `local_directory: true` が含まれます。+### 実行ディレクトリ実行ごとに作業ディレクトリのルート(既定は `~/multica_workspaces`)の下にディレクトリが作られ、チェックアウトしたコード、出力、ログが入ります。同じタスクの後続の実行はこれを引き続き使います。diff --git a/apps/docs/content/docs/daemon-runtimes.ko.mdx b/apps/docs/content/docs/daemon-runtimes.ko.mdxindex 0ad84fb355..5db671908a 100644--- a/apps/docs/content/docs/daemon-runtimes.ko.mdx+++ b/apps/docs/content/docs/daemon-runtimes.ko.mdx@@ -162,6 +162,8 @@ cd ~/.multica/cursor-mcp-auth/<agent-id>/user-login/workdir && CURSOR_DATA_DIR=~데몬은 시작하고 약 30초 뒤에 처음 정리하고, 그 뒤로는 2시간마다 정리합니다. 진행 중인 실행이 쓰는 디렉터리는 정리하지 않습니다. `multica daemon disk-usage`로 워크스페이스별, 실행별 사용량을 볼 수 있습니다. 아래 기간은 기본값이며 해당 `MULTICA_GC_*` 변수는 [환경 변수](/environment-variables#gc)에 있습니다.+실행별 표의 `MODE` 열에는 직접 실행을 `in place`로 표시합니다. 실행 메타데이터에서 해당 모드를 확인할 수 있으면 JSON 출력의 해당 행에 `local_directory: true`가 포함됩니다.+### 실행 디렉터리실행마다 작업 디렉터리 루트(기본값 `~/multica_workspaces`) 아래에 디렉터리가 생기고, 체크아웃한 코드와 출력, 로그가 들어갑니다. 같은 태스크의 후속 실행은 이 디렉터리를 이어서 씁니다.diff --git a/apps/docs/content/docs/daemon-runtimes.mdx b/apps/docs/content/docs/daemon-runtimes.mdxindex ee5c62411c..319186cf7b 100644--- a/apps/docs/content/docs/daemon-runtimes.mdx+++ b/apps/docs/content/docs/daemon-runtimes.mdx@@ -162,6 +162,8 @@ The login applies from the agent's next run; the current run does not pick it upThe daemon runs its first cleanup about 30 seconds after starting, then every 2 hours. Directories in use by a running run are never cleaned. `multica daemon disk-usage` shows usage per workspace or per run. The durations below are defaults; the matching `MULTICA_GC_*` variables are in [Environment variables](/environment-variables#gc).+The per-run `MODE` column marks in-place runs with `in place`. JSON reports these rows as `local_directory: true` when the run metadata identifies the mode.+### Run directoriesEach run gets a directory under the workspaces root (default `~/multica_workspaces`) holding the checked-out code, output, and logs; later runs on the same issue reuse it.diff --git a/apps/docs/content/docs/daemon-runtimes.zh-Hant.mdx b/apps/docs/content/docs/daemon-runtimes.zh-Hant.mdxindex 4bb79f36e4..1bf875caef 100644--- a/apps/docs/content/docs/daemon-runtimes.zh-Hant.mdx+++ b/apps/docs/content/docs/daemon-runtimes.zh-Hant.mdx@@ -163,6 +163,8 @@ cd ~/.multica/cursor-mcp-auth/<agent-id>/user-login/workdir && CURSOR_DATA_DIR=~守護程序啟動約 30 秒後清理一次,之後每 2 小時一次。正在執行的執行用到的目錄不會被清理。`multica daemon disk-usage` 可以按工作區或按執行檢視佔用。下文的時長都是預設值,對應的 `MULTICA_GC_*` 變數見[環境變數](/environment-variables#gc)。+逐次執行表的 `MODE` 欄用 `in place` 標記直接執行。如果執行中繼資料記錄了這個模式,JSON 輸出會在對應的項目中包含 `local_directory: true`。+### 執行目錄每次執行在工作目錄根目錄(預設 `~/multica_workspaces`)下有一個目錄,放檢出的程式碼、輸出和日誌;同一任務的後續執行會續用它。diff --git a/apps/docs/content/docs/daemon-runtimes.zh.mdx b/apps/docs/content/docs/daemon-runtimes.zh.mdxindex 695407a072..73e0bb174d 100644--- a/apps/docs/content/docs/daemon-runtimes.zh.mdx+++ b/apps/docs/content/docs/daemon-runtimes.zh.mdx@@ -163,6 +163,8 @@ cd ~/.multica/cursor-mcp-auth/<agent-id>/user-login/workdir && CURSOR_DATA_DIR=~守护进程启动约 30 秒后清理一次,之后每 2 小时一次。正在执行的运行用到的目录不会被清理。`multica daemon disk-usage` 可以按工作区或按运行查看占用。下文的时长都是默认值,对应的 `MULTICA_GC_*` 变量见[环境变量](/environment-variables#gc)。+逐次运行表的 `MODE` 列用 `in place` 标记直接运行。如果运行元数据记录了该模式,JSON 输出会在对应条目中包含 `local_directory: true`。+### 运行目录每次运行在工作目录根目录(默认 `~/multica_workspaces`)下有一个目录,放检出的代码、输出和日志;同一任务的后续运行会续用它。diff --git a/server/cmd/multica/cmd_daemon.go b/server/cmd/multica/cmd_daemon.goindex 985b4f4993..5eee86b954 100644--- a/server/cmd/multica/cmd_daemon.go+++ b/server/cmd/multica/cmd_daemon.go@@ -88,6 +88,7 @@ var daemonDiskUsageCmd = &cobra.Command{"overridable via MULTICA_GC_ARTIFACT_PATTERNS) so the report stays in sync with what the GC reclaims.\n" +"A .git directory counts toward the total but never toward the artifact subset — the GC frees it only\n" +"when it removes the whole run directory. Symlinks are never followed.\n\n" ++ "The MODE column marks in-place runs when recorded in local metadata. JSON includes local_directory: true for those runs.\n\n" +"The STATUS column shows the current status of the issue each directory belongs to, which requires\n" +"contacting the server. When the machine is offline, logged out, or the request fails, the column is\n" +"left blank and the rest of the report still prints. --by-workspace has no STATUS column and therefore\n" +@@ -2248,6 +2249,10 @@ func printDiskUsageTaskTable(w io.Writer, report daemon.DiskUsageReport) {for _, task := range report.Tasks {displayedSize += task.SizeBytesdisplayedArtifact += task.ArtifactSizeBytes+ mode := "-"+ if task.LocalDirectory {+ mode = "in place"+ }rows = append(rows, []string{task.WorkspaceShort + "/" + task.TaskShort,task.Kind,@@ -2255,9 +2260,10 @@ func printDiskUsageTaskTable(w io.Writer, report daemon.DiskUsageReport) {formatAge(task.AgeSeconds),formatBytes(task.SizeBytes),formatBytes(task.ArtifactSizeBytes),+ mode,})}- cli.PrintTable(w, []string{"PATH", "KIND", "STATUS", "AGE", "SIZE", "ARTIFACTS"}, rows)+ cli.PrintTable(w, []string{"PATH", "KIND", "STATUS", "AGE", "SIZE", "ARTIFACTS", "MODE"}, rows)if len(report.Tasks) < report.TotalTaskCount {// Report-wide totals stay anchored to the full scan; the displayeddiff --git a/server/cmd/multica/cmd_daemon_diskusage_status_test.go b/server/cmd/multica/cmd_daemon_diskusage_status_test.goindex adbecf7d44..02445dddbc 100644--- a/server/cmd/multica/cmd_daemon_diskusage_status_test.go+++ b/server/cmd/multica/cmd_daemon_diskusage_status_test.go@@ -592,3 +592,29 @@ func TestEnumerateDiskUsageRootsUsesAndDeduplicatesProfileConfig(t *testing.T) {}}}++func TestPrintDiskUsageTaskTableMarksInPlaceRun(t *testing.T) {+ var output bytes.Buffer+ printDiskUsageTaskTable(&output, daemon.DiskUsageReport{+ TotalTaskCount: 2,+ Tasks: []daemon.TaskDiskUsage{+ {WorkspaceShort: "ws", TaskShort: "local", LocalDirectory: true},+ {WorkspaceShort: "ws", TaskShort: "unknown"},+ },+ })+ var localRow, unknownRow string+ for _, line := range strings.Split(output.String(), "\n") {+ if strings.Contains(line, "ws/local") {+ localRow = line+ }+ if strings.Contains(line, "ws/unknown") {+ unknownRow = line+ }+ }+ if !strings.Contains(localRow, "in place") {+ t.Fatalf("local run is missing its mode: %q", localRow)+ }+ if unknownRow == "" || strings.Contains(unknownRow, "in place") {+ t.Fatalf("expected an unmarked row for the unknown run, got %q", unknownRow)+ }+}diff --git a/server/internal/daemon/diskusage.go b/server/internal/daemon/diskusage.goindex 23481ef24e..c1b926a9a4 100644--- a/server/internal/daemon/diskusage.go+++ b/server/internal/daemon/diskusage.go@@ -27,6 +27,7 @@ type TaskDiskUsage struct {Kind string `json:"kind"`ParentID string `json:"parent_id,omitempty"`ParentStatus string `json:"parent_status"`+ LocalDirectory bool `json:"local_directory,omitempty"`AgeSeconds int64 `json:"age_seconds"`SizeBytes int64 `json:"size_bytes"`ArtifactSizeBytes int64 `json:"artifact_size_bytes"`@@ -334,6 +335,7 @@ func buildTaskUsage(taskDir, wsID, taskShort string, matcher artifactMatcher) Ta}usage.Kind = string(meta.Kind)usage.ParentID = parentIDForMeta(meta)+ usage.LocalDirectory = meta.LocalDirectoryif !meta.CompletedAt.IsZero() {usage.AgeSeconds = int64(time.Since(meta.CompletedAt).Seconds())} else if age, ok := gcMetaFileAge(taskDir); ok {diff --git a/server/internal/daemon/diskusage_test.go b/server/internal/daemon/diskusage_test.goindex c24630e421..087e61ae26 100644--- a/server/internal/daemon/diskusage_test.go+++ b/server/internal/daemon/diskusage_test.go@@ -55,10 +55,11 @@ func TestScanDiskUsage_AggregatesAndCategorizes(t *testing.T) {taskA2 := filepath.Join(root, wsA, "bbbbbbbb")writeFile(t, filepath.Join(taskA2, "workdir/notes.md"), 500)mustWriteMeta(t, taskA2, execenv.GCMeta{- Kind: execenv.GCKindChat,- ChatSessionID: "chat-1",- WorkspaceID: wsA,- CompletedAt: time.Now().Add(-1 * time.Hour),+ Kind: execenv.GCKindChat,+ ChatSessionID: "chat-1",+ WorkspaceID: wsA,+ CompletedAt: time.Now().Add(-1 * time.Hour),+ LocalDirectory: true,})taskB1 := filepath.Join(root, wsB, "cccccccc")@@ -190,6 +191,9 @@ func TestScanDiskUsage_AggregatesAndCategorizes(t *testing.T) {if err != nil {t.Fatalf("marshal report: %v", err)}+ if got := strings.Count(string(raw), `"local_directory":true`); got != 1 {+ t.Fatalf("expected exactly one in-place run, got %d: %s", got, raw)+ }for _, want := range []string{`"kind"`,`"parent_status"`,