Xcode DerivedData written into ~/.copilot/session-state accumulates indefinitely — please use a standard location
まだ誰も着手していません。
- 主要言語
- Shell
- スター
- 11.2k
- フォーク
- 1.9k
- 平均マージ
- 14時間 16分
- マージ済み PR(30日)
- 6
説明
Describe the bug
When Copilot CLI builds or tests Xcode projects, it writes Xcode derived data inside its own session-state directory rather than the standard Xcode location. I've found it in two layouts:
- ~/.copilot/session-state//files/apptests-deriveddata/
- ~/.copilot/session-state//files/diagnostics/DerivedData/
These contain the usual derived data content (Build/, CompilationCache.noindex/, SourcePackages/, ModuleCache.noindex/, Info.plist, etc.). On my machine a single session's DerivedData folder had grown to over 20 GB. And I had instances of both paths listed above, so 40GB+ used by stale Copilot sessions.
Why this is a problem
- Silent, unbounded disk growth. Derived data is large and regenerable, but it's stored per-session with no apparent retention policy, so it accumulates until the user manually prunes sessions.
- Hidden from every existing cleanup path. Because it lives in a hidden dot-folder rather than ~/Library/Developer/Xcode/DerivedData, it's invisible to Xcode's own cache management, to disk-space tools, and to Xcode cleanup utilities (e.g. DevCleaner). Users have no reason to suspect their vanishing disk space is under ~/.copilot.
- Not documented. The session-state docs describe events.jsonl / workspace.yaml, but I couldn't find any mention that multi-gigabyte build artefacts are also stored there, and the location within a session varies.
Suggested behaviour
- Prefer the platform-standard location (~/Library/Developer/Xcode/DerivedData) as other CLI coding agents do (Claude Code and Codex CLI don't redirect xcodebuild output), so existing Xcode tooling and cleaners manage it; or
- if session isolation is required, use a documented, dedicated cache location (e.g. ~/Library/Caches/ on macOS, marked as excluded from Time Machine) with automatic cleanup — deleted when the session ends or is pruned, and/or subject to a retention/size cap.
- At minimum, document that derived data is stored under session-state and that /session prune / /session delete is the way to reclaim it.
Environment
- Copilot CLI version: 1.0.70
- OS: macOS 26.5.1
- Xcode: 26.2
Affected version
1.0.70
Steps to reproduce the behavior
- Use Copilot CLI in an iOS/macOS project and ask it to build or run tests.
- Inspect ~/.copilot/session-state//files/ — derived data appears in one of the layouts above.
- Repeat across sessions/days; the folders are never cleaned up.
Expected behavior
- Prefer the platform-standard location (~/Library/Developer/Xcode/DerivedData) as other CLI coding agents do (Claude Code and Codex CLI don't redirect xcodebuild output), so existing Xcode tooling and cleaners manage it; or
- if session isolation is required, use a documented, dedicated cache location (e.g. ~/Library/Caches/ on macOS, marked as excluded from Time Machine) with automatic cleanup — deleted when the session ends or is pruned, and/or subject to a retention/size cap. Or a temporary location like /tmp/build.
- At minimum, document that derived data is stored under session-state and that /session prune / /session delete is the way to reclaim it.
Additional context
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、xcodebuild によって生成されたデータが ~/.copilot/session-state//files/ 以下のどこに配置されるのか、また /session prune と /session delete がそれらのパスをどのように処理するのかを追跡します。events.jsonl と workspace.yaml に関する session-state のドキュメントを確認します。派生データが標準の Xcode の場所、またはクリーンアップ機能を備えた文書化されたキャッシュを使用し、ユーザーが文書化されたセッションコマンドを通じて既存のデータを削除して領域を回収できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- macos
- 領域
- build-system, cli, devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100