6.2 KiB
External rereview: task-feature-own-store-reminder-hooks
1. Result: approve
Approve. The prior blocker is fixed: hook-appended Task reminders are now folded into the effective request context before usage accounting and the second request-threshold compaction decision, and threshold-yield preserves the queued system item durably instead of dropping model-visible history.
2. Summary of fix reviewed
The fix adds an internal PreRequestAction::YieldWith(Vec<Item>) variant in llm-worker and updates PodInterceptor::pre_llm_request() to:
- keep the existing pre-hook request-threshold check for the already-present context;
- run pre-request hooks and drain any host-mediated
SystemItemAppendHandleappends; - build an
effective_len = context.len() + system_items.len(); - run request-threshold compaction again against the post-append effective context;
- if the post-append threshold yields, commit the queued system items and return
YieldWith(items)soWorkerappends them to history before yielding; - otherwise record usage with the effective post-append length and continue with the queued items.
This keeps the hook append boundary host-mediated while making the model-visible request context match the context used for usage tracking.
3. Prior-blocker assessment
- Hook-appended
SystemItem::TaskReminderincluded before usage accounting: Fixed.PodInterceptor::pre_llm_request()now drains hook system items before the finalusage_tracker.note_request(...)call and computeseffective_lenfromcontext.len() + system_items.len(). UsageTracker::note_request()uses post-append context length: Fixed. The call now passeseffective_len, so a fired Task reminder is counted in the recorded request history length.- Request-threshold compaction checks the post-append context: Fixed. After hook drain,
estimated_tokensis recomputed over aCowthat includes the queued items, andrequest_threshold.should_compact(current_tokens)runs again before the request is sent. - Threshold yield preserves queued system items durably: Fixed. On post-append threshold yield,
PodInterceptorcommits the queued system items, returnsPreRequestAction::YieldWith(items), andWorkerappends those items into history before returningWorkerResult::Yielded. The next request therefore starts from durable/in-memory history that includes the reminder. YieldWith(Vec<Item>)does not expose public raw injection throughpod::hook: Acceptable.YieldWithis an internalllm-workerinterceptor action, not a publicpod::hookaction. The public hook-facing append API remains the typedSystemItemAppendHandle; public hook types do not gain rawItemconstruction authority.
4. Rechecked requirements
- TaskStore/reminder ownership remains in Task feature: Still satisfied.
TaskStoreandTaskReminderStateremain insidecrates/pod/src/feature/builtin/task.rs;Podkeeps only the feature façade needed for installation, restore, rewind, and compaction snapshot/overview calls. - No
PodInterceptorTask special-casing returned: Confirmed. ProductionPodInterceptorcode does not branch on Task tool names and does not own Task reminder state; Task behavior is driven through feature hooks. - Task tool metadata/behavior unchanged: Confirmed by diff scope. The Task tool implementations and metadata remain in
crates/tools/src/task.rs; the feature still registerstools::task_tools(...)with the shared feature-owned store. - No raw
Itemexposure in public Hook API: Confirmed.SystemItemAppendHandleexposes typed append methods such asappend_task_reminder; the rawItemvectors remain inside worker/interceptor internals. - No generic event channels or UI dialogs: Confirmed in the reviewed diff. The fix is confined to worker/interceptor request flow and tests.
- Snapshot/restore/rewind semantics remain safe: Still acceptable.
TaskFeature::restore_from_history()mutates the existing shared store handle, preserving installed Task tool handles after restore/rewind. The prior focused restore test still passes. - Tests cover fixed accounting/compaction path: Satisfied. New/focused tests cover post-append usage length and post-append request-threshold yield preservation, in addition to the existing Task reminder and hook append tests.
5. Blockers
None.
6. Non-blockers / follow-ups
TaskFeature::from_history()/restore_from_history()still accept rawllm_worker::Itemslices as an internal restore façade. This remains acceptable for this ticket, but can be tightened in a later boundary-cleanup pass if feature restore APIs are made more typed.- The new
YieldWith(Vec<Item>)is an internal escape hatch with rawItems. It is justified here for durable preservation of host-created system items on yield, but future uses should stay interceptor-owned and should not be surfaced through public plugin/hook APIs.
7. Validation assessed or rerun
Reviewed:
- original review artifact;
- ticket and delegation intent;
git diff develop...HEADand the fix commit960f2a3 fix: account hook system item appends;- current
llm-worker,pod::ipc::interceptor, Task feature, hook API, and relevant Pod restore/snapshot code.
Commands rerun from /home/hare/Projects/yoi/.worktree/task-feature-own-store-reminder-hooks:
cargo test -p pod task_reminder_hook_append_is_counted_in_usage_request_len --lib— passed.cargo test -p pod pre_llm_request_yields_with_hook_appends_when_post_append_threshold_exceeded --lib— passed.cargo test -p pod hook --lib— passed.cargo test -p llm-worker --lib— passed.cargo test -p pod task_reminder --lib— passed.cargo test -p pod restore_from_history_keeps_existing_store_handle_for_installed_tools --lib— passed.git diff --check develop...HEAD— no whitespace errors reported.
I did not rerun full workspace tests or nix build .#yoi as part of this rereview.
8. Residual risk
Residual risk is low for this ticket. The main area to watch is future expansion of YieldWith(Vec<Item>): it should remain an internal worker/interceptor mechanism for preserving already-authorized, host-created history appends across yield/compaction boundaries, not a public raw-history injection mechanism.