Skip to content

Deliver newly Matched rules at the earliest dispatch #59

Closed

Description

@frap129

Parent

#38

What to build

Use the pre-dispatch transform as the completeness gate so every newly Matched rule is available at the first provider dispatch where it can affect work, while preserving each Rule lifetime.

Acceptance criteria

  • The pre-dispatch transform re-evaluates all Rule lifetimes against the freshest session context on every dispatch.
  • Initial durable matches retain established user-message delivery.
  • A durable Rule first matched mid-session is persisted through a synthetic no-reply message and equivalent guidance is available to the current in-memory dispatch.
  • Transient Rule delivery remains dispatch-local and is consumed after one usable dispatch.
  • Context producers record context without manipulating Rule-delivery state.
  • Plugin-authored synthetic messages do not recursively trigger matching or delivery.
  • Acceptance coverage proves next-dispatch visibility through the real server hook map and mocked OpenCode client interactions.

Blocked by

Activity

  1. frap129 commented on Aug 30, 2026

    @frap129
    OwnerAuthor

    Implemented in 1d4504d.

    • The pre-dispatch transform re-evaluates all Rule lifetimes against freshest context on every dispatch: src/runtime.ts onMessagesTransform -> evaluateSessionRules per dispatch
    • Initial durable matches retain user-message delivery: src/chat-message-persistence.test.ts:66
    • A durable rule first matched mid-session (any file-observation-family condition: globs, fileContains, or both) is persisted through a synthetic no-reply message via awaited session.prompt({ noReply: true }) and equivalent guidance reaches the current dispatch: src/observation-admission.test.ts:122,340 (incl. globs-only admission at observation time)
    • Transient delivery remains dispatch-local and consumed after one usable dispatch: src/rule-delivery.test.ts:784,900,947
    • Context producers record context without touching delivery state; the runtime owns all transitions
    • Plugin-authored synthetic messages do not recursively trigger matching: src/observation-admission.test.ts:179
    • Next-dispatch visibility proven through the real server hook map with mocked client interactions, including the fallback/retry path: src/observation-admission.test.ts:221 (transient fallback + persistence retry through transform).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions