Skip to content

feat(kin): a quiet scheduled ping keeps an idle session's shared instructions cached - #1094

Merged
GLDRoger merged 13 commits into
kinfrom
train-18-1129/step-3
Nov 29, 2026
Merged

GLDRoger merged 13 commits into
kinfrom
train-18-1129/step-3

Conversation

@GLDRoger

Copy link
Copy Markdown
Owner

A new Kin session reuses the shared first block only while the provider still has it cached. After about 49 idle minutes it lapses, so the next session rewrites it.

  • A scheduled job sends a one-message, unsaved Claude request on the session's own first block, but only when that part's measured traffic shows the ping saves more than it costs.
  • It is for the first-block placement only. The train's join commit makes it read the host's kinInstructionPlacement and never ping under "system", where nothing is reused between sessions. It also gives the ping the worded prompt "Kin is keeping this conversation ready: nobody is waiting and nothing is asked. This turn calls no tool, kin_skip included, and its whole reply is one plain word." in place of this step's placeholder.
  • The request denies every tool. No tool, RPC, tap, model output or person's message can create, change, trigger or stop it.
  • It stops after one response. Its usage is charged once to the owner's budget and shown as spend, never as a turn. It yields at low budget, and two misses in a row stop it.
  • Migration K245 adds kin_cache_parts and three cache columns on kin_wakeups.

People-change: Agents in a busy company can reuse their instructions sooner, and a quiet company, or a host that keeps instructions in the system prompt, pays for no keep-warm requests.

Checked as part of train 18's one check at the tip.

Two independent reviews by Claude Opus 5.5: the first found it does not land yet, and the second, after those fixes, found it LANDS. Both rounds' fixes are on this branch.

🤖 Generated with Claude Code

GLDRoger and others added 13 commits November 29, 2026 14:04
Use each part's measured request history to schedule a detached Claude cache ping. Give its SDK process the normal instruction block and roster but no tool authority.

T3-file: apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts: keep the base leading-block expectation valid with the SDK's string-or-block-array type.

People-change: A busy company's agents can reuse their instructions sooner; a quiet company does not pay for keep-warm requests.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
T3-file: packages/shared/src/serverSettings.test.ts: verify the shared patch implementation cannot toggle a host-only setting without removing the existing wire field.

People-change: None; records why the test belongs at the shared settings boundary.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Forward the accepted-offer acknowledgement. Keep part observations fresh over a long-running query and refuse to warm a stale launch after a live model or flag change.

People-change: Ordinary chats still acknowledge queued replies when cache measurement is on.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
A ping that missed the cache rewrote the whole block, but only hits were used to price the next
ping, so a prefix that never matched kept pinging at rewrite cost. The latest completed ping now
prices the next one, and a miss stops pings for that part.

People-change: A company whose keep-warm requests stop matching no longer pays for them repeatedly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A completed keep-warm row moved the lead's "since your last turn" mark, so the owner's reactions
before a ping never reached the next turn; a failed one counted in the evening summary's failed
wake-ups. Both reads now count only kind = 'turn'.

People-change: The owner's reactions reach the lead's next turn even after a keep-warm request; the evening summary no longer reports keep-warm failures as failed wake-ups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bill known usage through KinBudget, require a real at-risk sample, and stop on unknown-cost results until a real turn supplies evidence. Keep the normal stream safe and close only the leased MCP session.

People-change: Keep-warm requests count once toward the owner’s budget and shown spend, without adding chat turns.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Claude used stateless discovery for agent turns but fell back to a different descriptor schema for a stateful upkeep lease. Pin the documented stateful handshake for both leading-block queries and recheck active-agent admission before serving a lease.

People-change: Keep-warm requests can now reuse the same tools a fresh agent session sees, and paused or retired agents cannot open upkeep sessions.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Reflect the roster lease admission in the unrelated numbers fixture, which denies identity operations it does not exercise.

People-change: No change to how numbers or upkeep work.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Allow stateless discovery and listing through lease admission while preserving the full roster comparison and existing stateful session restrictions. Restore real Claude sessions to their original protocol selection and launch options.

People-change: Keep-warm requests use the same protocol as agent turns without changing what a real turn can see or do.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Use the budget’s speculative-work admission rule at both gates, recover from a lone cache miss after real demand, and keep upkeep’s token usage out of turn cache-hit rates without changing its charge.

People-change: Keep-warm requests yield at low budget, recover after a one-off miss, and no longer inflate the cache-hit rate shown for turns.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
A real turn releases the wait after a lone miss; it cannot break the sequence of upkeep outcomes or the second miss would never suppress a retry.

People-change: Two consecutive keep-warm misses stop repeat spending even when real work ran between them.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
…ions cached

People-change: none

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
People-change: none

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@GLDRoger
GLDRoger merged commit 529eb0a into kin Nov 29, 2026
13 of 17 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T15:34:49.362555Z 326338c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant