feat(acp): scope nudge + compress-outcome bookkeeping per session (#317) - #327
Conversation
|
解决冲突 pull master 重写review这个 并给出一句话总结 |
Issue #317 seam #3: key nudge-dedup and compress-failure bookkeeping by session id. nudgeShownTurns was a process-global Set and the compress-outcome tracker a single global slot; under a host that runs multiple concurrent sessions through one extension instance (Prime's inline RLM model) they clobbered each other. Both are now Map<sid,...>, matching the existing overflow/throttle/dead isolation pattern. Six methods take a sid; index.ts/compress-tool.ts pass it, and session_shutdown drops each session's entries. Single-session behavior is unchanged (full suite green); three new tests cover same-turn cross-session isolation. Part of #317.
1c14fd2 to
1f4576d
Compare
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-327Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr327.tgz
pi install ./packageThis comment is automatically updated on each push. |
Re-reviewed after syncing onto latest What conflicted & how it was resolved
All call sites in Diff cleanliness — 4 files only ( Verification
One-sentence summary 一句话总结:把 nudge 去重账本和压缩失败熔断器按 session id 隔离,避免多会话共用同一扩展实例时互相串台(与既有 overflow/throttle 隔离模式一致),单会话行为不变;已 rebase 到最新 master、解决与 #316 重注入逻辑的冲突并同步按 sid 隔离了新增的 token 戳表,typecheck/test/build + 全部 CI 均绿,可以合并。 |
Part of #317 — seam #3: session-scoped runtime bookkeeping.
What
Keys two pieces of per-turn runtime state by session id, so one extension instance serving multiple concurrent sessions (Prime's inline RLM model) cannot cross-contaminate them:
nudgeShownTurns: process-globalSet<turnKey>→Map<sid, Set<turnKey>>compressFailTurnKey/compressFailCount+ sharedseen) →Map<sid, { seen, failTurnKey, failCount }>This matches the isolation already used for
overflowEpisodes,throttleEpisodes, anddeadCompressCounts. Six methods now take asid; call sites insrc/index.tsandsrc/compress-tool.tspass it, andsession_shutdowndrops each session's entries (memory hygiene for long-lived multi-session processes).Scope / non-goals
Verification
npm run typecheckcleannpm test: 615 tests — 612 pass / 0 fail / 3 pre-existing skipstests/compress-retry.test.tsassert same-turn cross-session isolation (independent counters, per-session clear, per-session nudge ledger)npm run buildsucceeds (self-contained bundle)Base:
master(v0.1.58).