chore(core): retire dead context/inject.ts twin (T-605/T-606, ADR-049)#61
Merged
Conversation
context/inject.ts (buildContextBlock/injectContext, user-message context placement) was the recorded T-605/T-606 implementation but had ZERO live callers — referenced only by its own test. The live context-injection path is chat/context-injection.ts::buildContextInjection (T-MR13, ADR-025), a <workspace-context> system-prompt block used in both chat/handler.ts and agent/turn-handler.ts. The system-prompt placement won; the user-message twin is the dead loser. Delete it + its 6-test file. Deleting does not orphan context/snippet.ts (still imported by annotations/indexer/chunk-tree/ engine). No protocol/codegen change; no behavior change (zero live callers).
- ADR-049: documents the T-605/T-606 (user-message) -> T-MR13 (system-prompt buildContextInjection) supersession and the retire, mirroring the ADR-039 dead-twin retire precedent. AI council (codex-cli 0.134.0 + gemini-cli 0.41.2) UNANIMOUS Q0-Q4=A. - docs/adr/index.md: add the ADR-049 row. - road-to-v1-0.md: T-605/T-606 stay [x]; done-comments updated to cite the live buildContextInjection (capability is live via the system-prompt placement, only the losing implementation file was removed).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Retire the dead context-injection twin
packages/core/src/context/inject.ts(+ its test), superseded by the livebuildContextInjection.context/inject.ts(buildContextBlock/injectContext, user-message placement) was the recorded implementation of T-605 (context-block injection) + T-606 (cache-friendly placement), but had zero live callers — referenced only by its owninject.test.ts. The live path ischat/context-injection.ts::buildContextInjection(T-MR13, ADR-025), which folds the snippets into a bounded<workspace-context>system-prompt block, used in bothchat/handler.ts:356andagent/turn-handler.ts:312. The system-prompt placement won; the user-message twin is the dead loser.Same retire shape as PR #51 (dead
tracking/audit-log.ts, T-413, ADR-039) and exactly the cleanup ADR-048 named when it flaggedcontext/inject.tsas the one genuinely dead twin.Why it is safe
packages/core/src+clients/(excluding its own test and/dist/): zero callers. No barrel/index re-exports.context/snippet.ts—Snippetis still imported byannotations.ts,indexer.ts,chunk-tree.ts,engine.ts.Both impls preserve the same cache goal
Keep the cached static prefix byte-identical, let the per-turn context ride where cache misses are expected —
inject.tsvia the user message,buildContextInjectionvia the system-prompt suffix after thecache_control'd guidelines/rules prefix. No insight lost; the live placement additionally gives better instruction-following steering.AI council
codex-cli 0.134.0 + gemini-cli 0.41.2 (2026-06-02) — UNANIMOUS:
[x], done-comments updated to cite the live implChanges
context/inject.ts+context/inject.test.ts.road-to-v1-0.mdT-605/T-606 done-comments updated (stay[x]— the capability is live via the system-prompt placement).Verification
task cideterministic phases (lint, build, typecheck, format) green every run. Core test suite 3/4 full runs green (1120 passed / 1 skip;-6= the removedinject.test.ts).The 1/4 failure is a pre-existing, intermittent flake unrelated to this diff:
chat/handler-list.test.ts(conversationListnewest-first order, PR #58 / ADR-046) trips on a same-millisecond timestamp tie under full-suite load — it passes 3/3 in isolation, andsessions/watcher.test.ts(chokidar debounce) rotated into the same slot on one run (passes 2/2 in isolation). This diff touches none of those modules. Remote CI (6-node matrix) is the authoritative gate.No checkbox flip — T-605/T-606 stay
[x].