`session_store_sql` silently returns empty when session sync is set to local
- Langage dominant
- Shell
- Étoiles
- 11.2k
- Forks
- 1.9k
- Merge moyen
- 14 h 16 min
- PR mergées (30 j)
- 6
Description
### Describe the bug
When `sessionSync.level = "local"` (user chose "Keep on this device only"), the `session_store_sql` tool is still injected into every agent's system message and remains callable — but returns 0 rows for all tables. There is no indication to agents that the cloud store is empty *because sync is disabled* — agents can't distinguish this from a user who genuinely has no session history.
The local `~/.copilot/session-store.db` has all the data (600+ sessions, 5,000+ turns), but the system message directs agents to use `session_store_sql` for session history queries, so they conclude there's no history.
### Steps to reproduce
1. Select "Keep on this device only" when prompted for session storage (config: `sessionSync: [{ origin: "*", level: "local" }]`)
2. Use the CLI — sessions accumulate in `~/.copilot/session-store.db`
3. In any session, ask "what did I work on this week?" or have an agent query `session_store_sql`
4. Agent gets 0 results and reports no session history
### Expected behavior
When cloud sync is disabled, one of:
1. **Don't expose `session_store_sql`** — if the cloud store won't have data, don't offer the tool
2. **Have `session_store_sql` query the local DB** — the schemas are compatible (`sessions`, `turns`, `checkpoints`, `session_files`, `session_refs` exist in both)
3. **At minimum, annotate the tool description** so agents know the cloud store won't have data when sync is disabled, and can fall back to the local DB
The above are suggestions — the team likely has better ideas for the right approach given the broader session storage architecture.
### Actual behavior
- `session_store_sql` is injected unconditionally with no awareness of the `sessionSync` config
- Returns 0 rows for all queries — agents can't distinguish "no sessions" from "sync disabled"
- The system message actively encourages agents to use this tool for temporal queries ("what did I work on?", "find prior sessions", etc.)
### Impact
- Automated agents (maintenance tasks, briefings, session digests) that query `session_store_sql` silently get wrong results
- The `/chronicle` feature and any built-in session history features are effectively broken for local-only users
- No error or warning — just empty results that look like valid "no data" responses
### Environment
- Copilot CLI: 1.0.24
- OS: Windows 11
- Config: `sessionSync: [{ origin: "*", level: "local" }]`
- Local session-store.db: 105 MB, 613 sessions, 5,342 turns (healthy)
- Cloud session store: 0 rows across all tables
### Workaround
Query `~/.copilot/session-store.db` directly via Python/sqlite3. The schema is compatible. This requires every consumer of session data to implement fallback logic.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par le chemin d’injection de session_store_sql et la gestion de la configuration de sessionSync, puis examinez ~/.copilot/session-store.db ainsi que le schéma de cloud-store nommé dans le rapport. Comparez le comportement en local uniquement avec l’outil cloud et déterminez quel fallback ou avertissement pris en charge convient à l’architecture de stockage des sessions. La tâche est terminée lorsque les utilisateurs en local uniquement ne reçoivent plus de résultats trompeurs indiquant un historique vide.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python, shell, sql, sqlite
- Domaine
- cli, database
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- À clarifier
- Accessibilité débutants
- 38/100