evolve plugin: keep unsent turns, and a learning call in progress, across a config reload

オープン
#2,045 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
15/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go

調査の方向性

Start from the review thread on PR #2028 and docs/evolve-plugin.md ("What is learned from"). Then read the evolve plugin's Shutdown, process_trajectory and its recorder/batch-send path to see where unsent turns, retry slots and batch sequence live, plus the reloader's drainWindow handling. Option 2 is the smallest first slice; done means a reload neither drops unsent turns nor cancels an in-flight learning call, with tests for both and the doc updated.

索引モデルが issue の本文から書いたものです。

説明

Follow-up to #2028, from review.

Problem

A config reload replaces the evolve plugin's instance. The reloader swaps in new pipelines and stops the old ones once their requests drain (at most drainWindow, 10 minutes). Stopping the old instance calls Shutdown, which:

  • drops every session's unsent turns. These are the turns recorded since the session's last batch was sent, which can be up to idle_after_seconds (15 minutes) of work per session.
  • cancels a learning call in progress. process_trajectory runs evolve's LLM before it answers, so this can throw away minutes of work. Evolve may or may not have committed the batch.

A change to any plugin's config triggers a reload, agentop's plugin toggles included, so this happens far more often than a restart.

Since #2028 the new instance no longer sends a session's history again: it starts at each session's next prompt, with the session's task as context. So nothing is learned twice, but the turns that were waiting at the reload are never learned.

Options

  1. Hand the sessions over within the process. The old instance passes its recorders (unsent turns, retry slots, batch sequence) to the new one: for example, through a package-level registry keyed by the plugin's endpoint and namespaces. The new instance adopts a session's recorder the first time it sees that session. The old instance keeps recording while it drains, so the handover has to happen at Shutdown, or the two instances must share the recorders.
  2. Let a learning call in progress finish. Shutdown stops the ticker but lets a call in progress finish within its context, instead of cancelling it.
  3. Persist unsent turns in Cortex's plugin state store (plugin-state.json). That covers restarts too, and would need a size bound.

Option 2 is small and independent of the others. 1 or 3 is the larger part.

Done when

  • After a reload, turns recorded by the old instance and not yet sent are sent exactly once, by one of the two instances, under batch ids evolve hasn't seen.
  • A reload doesn't cancel a learning call in progress, within a stated bound.
  • Tests cover both, and docs/evolve-plugin.md ("What is learned from") describes the result.

Assisted-By: Claude (Anthropic AI) [email protected]

主要言語
Go
スター
31
フォーク
49
平均マージ
9時間 43分
マージ済み PR(30日)
367

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rossoctl/cortex のほかの issue

rossoctl/cortex の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。