Skip to content

fix(ltm): Rank current-task knowledge and deliver task-shift deltas - #2018

Merged
BYK merged 16 commits into
mainfrom
fix-task-aware-ltm
Oct 9, 2026
Merged

BYK merged 16 commits into
mainfrom
fix-task-aware-ltm

Conversation

@BYK

@BYK BYK commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

Rank context-bound knowledge for the current task and deliver newly relevant entries through durable tail deltas while keeping the cached prefix stable.

Changes

  • Prefer real user prose, including mixed text/tool messages and the end of long requests; keep tool results out of task queries and use full task identity for cache revisions.
  • Keep the weakest genuine FTS match eligible for injection or recallable overflow.
  • Bound initial and compacted knowledge deltas; retain recent task additions and revalidate scoped knowledge and live synthetic sources during compaction.
  • Preserve correct re-sharing and removal order during debounce, with failing-first regressions for task switches, long requests, mixed messages, repeated compaction, revocation, and deleted sources.
  • Add a synthetic offline selector comparison without changing the production LTM budget.

Validation

  • Exact pushed revision: 250 tests passed across seven affected test files; workspace typecheck, lint (warnings only), format check, and build passed. Failing-first Sentry regressions cover bare acknowledgments, Unicode overflow titles, first-delivery references retained across a debounced edit, and removals from both appended and coalesced deltas. A further failing-first regression found that a second debounce rewrite erased a pinned removal marker; the rewritten selector now preserves both pre-rewrite and currently surfaced IDs. Bounded overflow suggestions describe unseen matches as a lower bound. Distinct ok fix auth requests exclude foreign chart guidance; explicit continuations (continue the work, go ahead with the plan) retain it only when the whole message refers to the prior task.
  • The five-case offline evaluation passed earlier; both holdouts still miss needed injection but retain recall coverage. This does not justify reducing the LTM budget.
  • Full local pnpm test timed out after 15 minutes; before the timeout, dashboard-api.test.ts failed because /api/v1/contradictions returned 200 rather than the expected 404 for a non-loopback peer. That same test fails alone with --printConsoleTrace; the gateway logged that remote management access was enabled. An earlier full local run also timed out after an embedding-backfill-throttle failure, which passed in isolation. Both independent reviews of da562bdf found the second-rewrite removal defect fixed by this revision and returned DO-NOT-MERGE for that head. Exact-head CI and fresh reviews are pending.

Review focus

Check task-query provenance, long-task tail coverage, cache/delta delivery, bounded compaction, source ownership, and scoped knowledge. Ordinary replay keeps already stored delta bytes frozen; revoked or deleted guidance leaves the prompt when a later compaction replaces that block, not immediately on an unchanged turn. This is the chosen cache-stability contract.

Comment thread packages/gateway/src/pipeline.ts
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ Patch coverage is 95.07% (135 of 142 changed executable lines covered; target 80%).
Project statement coverage is 85.85%.

Changed files with executable lines (4)
File Patch coverage Changed executable lines
packages/gateway/src/pipeline.ts 94.64% 106/112 covered; missed: 3628, 4011, 4019, 4041, 4085, 4086; partial branches: 3623, 3625, 3627, 3632, 3772, 3863, 3906, 4010, 4024, 4062, 4080, 24712
packages/core/src/ltm.ts 95.65% 22/23 covered; missed: 3011; partial branches: 3000, 3009, 3032
packages/core/src/task-text.ts 100.00% 5/5 covered
packages/core/src/temporal.ts 100.00% 2/2 covered

Generated by Coverage Action

Comment thread packages/gateway/src/pipeline.ts
Comment thread packages/gateway/src/pipeline.ts
Comment thread packages/gateway/src/pipeline.ts Outdated
Comment thread packages/core/src/ltm.ts Outdated
Comment thread packages/gateway/src/pipeline.ts
Comment thread packages/gateway/src/pipeline.ts
Comment thread packages/gateway/src/pipeline.ts
@BYK
BYK merged commit 62bcc05 into main Oct 9, 2026
35 checks passed
@BYK
BYK deleted the fix-task-aware-ltm branch October 9, 2026 18:33
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-09 18:33 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant