dsh-projection-guard
damonkoy/dsh-projection-guard
영속화된 세션 프로젝션 캐시를 보호합니다: 행 단위 JSON 저하 처리로 문제가 있는 프로젝션 단위 하나(예: Map을 저장하는 서드파티 플러그인)가 세션 제목이나 전체 캐시를 다시 멈추게 할 수 없으며, 누락된 제목을 채우는 시작 시 자가 복구 기능도 제공합니다.
설치
dsh plugin --profile web add github:damonkoy/dsh-projection-guardREADME
dsh-projection-guard
A DeepSeek Harness (DSH) plugin that guards the persisted session-projection cache against misbehaving projection units — so session titles (and every other projection) survive restarts no matter what third-party plugins do.
The bug it fixes
DSH persists per-session projection checkpoints (session titles, stats, permissions, …) into session_projcache.json. The write path serializes the whole per-session checkpoint in one JSON pass: if a single projection unit stores a non-JSON value (a Map, Set, class instance, cyclic or non-finite value — e.g. some third-party plugins), the entire write fails. The failure is fail-soft (log-only), so the cache silently stops updating. After a restart, every cold session loses its title projection and the UI falls back to showing the workspace folder name instead of the conversation title.
What this plugin does
-
Per-row degradation (runtime wrapper). It wraps
sessionProjectionCache.put()and drops only the rows that are not lossless JSON, keeping every healthy row durable. One bad unit can no longer stall the whole cache — titles,sessionListMetadata, stats etc. keep writing normally. -
Startup self-heal. On startup it scans persisted sessions whose cached title is missing and cold-reads their logs to backfill the
titleprojection, so an already-stale cache recovers automatically. -
Observability. A read-only
GET /projection-guard/statusroute reports wrapped-put call counts, dropped rows, and repaired titles (also shown as a small card in Settings when the client half is mounted).
No official or third-party files are modified — the guard is a pure runtime wrapper, so it survives dsh upgrades and works on any deployment.
Install
dsh plugin --profile web add github:DamonKoy/dsh-projection-guard
Restart dsh web. That's it.
Or add the repo as a profile dependency and include the bundle:
{
"dependencies": {
"dsh-projection-guard": "github:DamonKoy/dsh-projection-guard"
},
"dsh": {
"profile": {
"bundles": ["dsh-projection-guard"]
}
}
}
Then pnpm install in the profile directory and restart dsh web.
Configuration
| Key | Default | Meaning |
|---|---|---|
repairOnStart | true | Backfill missing cached titles from persisted logs at startup. |
logDropped | true | Warn per dropped non-JSON row (key + session id). |
Example (profile cordis.patch.yml overlay):
- id: projection-guard
config:
repairOnStart: true
logDropped: true
Development
npm test # unit tests for the guard core
License
MIT