Skip to content

feat(server): opt in to compaction before PR waits - #16855

Closed
MartinPTielemans wants to merge 3 commits into
pingdotgg:mainfrom
MartinPTielemans:feat/cache-aware-waiting
Closed

MartinPTielemans wants to merge 3 commits into
pingdotgg:mainfrom
MartinPTielemans:feat/cache-aware-waiting

Conversation

@MartinPTielemans

@MartinPTielemans MartinPTielemans commented Oct 7, 2026 •

Copy link
Copy Markdown

Problem

A large conversation that waits on PR news can wake with a cold provider prompt cache and reread its whole history (#16829, #13988).

Change

watch_pull_request gets an opt-in compactBeforeWaiting flag. Starting a new watch with it queues one native /compact turn after the current turn, or starts it right away on an idle conversation. The watch and the request commit together, and PR news that arrives in the meantime queues behind the compaction. Ordinary watches don't change, and a repeat call on an existing watch doesn't queue a second compaction.

Any provider with native compaction works. The request is rejected if the thread already has queued work, pending input or approval, unfinished maintenance, or an unsafe run state. In that case the agent is told to watch without compaction. If a question or approval arrives after opt-in, the queued compaction is dropped so the answer runs next. The user can cancel the queued compaction like any queued message.

This is a direction proposal and needs maintainer sign-off. Keepalives, budgets, and cache-TTL telemetry are out of scope.

Verification

  • vp test run on PullRequestWatchCompaction.test.ts, the pull-request toolkit handlers.test.ts, pullRequestWatch.test.ts, and ThreadStop.test.ts: 60 passed.
  • Server typecheck and targeted lint pass.
  • Real-world cache savings and summary quality are not measured.

Model: Claude Opus 5.5 · Harness: Claude Code in T3 Code

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Oct 7, 2026
Allow every provider with native compaction, mark the queued turn by id,
skip it instead of holding the queue when input arrives, and trim the
tool and user docs.
A provider without native compaction now fails that message as a
validation error, so the queue keeps delivering PR wakes behind it.
Pending input only drops the watch's compaction while it is still an
unedited /compact.

Copy link
Copy Markdown
Member

Note

This comment is posted by Julius' dot

This adds a new workflow that queues compaction when starting a PR watch. The description and your follow-up in #13988 say direction approval is still pending; that issue's warm-cache offer discussion does not approve this watch-triggered workflow. Closing under the prior-approval requirement. Please get explicit maintainer approval for this scope and link it when requesting reconsideration.

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants