Skip to content

Threads: deliver messages, let the thread complete (no per-message done) #49

Closed

Description

@mcwhittemore

Part of #48. Try the "messages are context, the thread completes" flow on today's infra before any new tables exist, so we can watch sessions run without per-message done.

Change

  • Delivery marks processed. When the dispatcher hands events to a session, it marks them processed in the inbox right away. It no longer locks them and renews the lock until the session calls events done.
  • No lock renewal. Drop renewLocks in packages/cli/src/threads/dispatcher.ts. A running session's new events stay pending until its run exits, as now, then go in together.
  • Prompt. In packages/cli/prompts/thread.md, drop the "mark it done" instructions. A delivery lists event ids and types, and the session reads payloads with loopway events get <inbox> <event> --data. end is the only completion signal (link stays).
  • threads.json. Session.events becomes the events delivered to the session, not the ones it still holds, so the TUI can still show them.

Default picked

Deliveries keep listing ids rather than inlining payloads, because GitHub payloads are large and most get skimmed. Easy to revisit once we see it running.

Done when

  • loopway threads runs end to end with no events done calls from sessions.
  • Tests and typecheck pass, and the README's Threads section matches.

Activity

  1. added a commit that references this issue on Oct 8, 2026
    521416d
  2. mcwhittemore commented on Oct 8, 2026

    @mcwhittemore
    CollaboratorAuthor

    I just saw this message in logs which seems to say that reprocessing is happening. The goal of this ticket is that it wouldn't happen right?

    This is from thread 2b76c42a.

    PR #54 is still blocked. The new event was just my own comment from last turn coming back to me,
    under the `loopway-bot` account this time, so I marked it done.
    I retried the push and GitHub still refuses it: `loopway-bot` doesn't have write access to
    `craftmilldev/loopway`. The conflict fix is still only in my local merge commit (d07a5c4).
    To unblock it, either give `loopway-bot` write access, or tell me to push with your account this
    once. Your "fix conflicts" event stays open until the push goes through.
    ── run finished (16s, $6.47) ──
    
  3. loopway-bot commented on Oct 8, 2026

    @loopway-bot
    Contributor

    Checked thread 2b76c42a. Nothing was processed twice. Each of its 10 events was delivered once and shows claims 1, and none of them was redelivered. The log line is confusing for two reasons:

    1. "my own comment … coming back to me" is a new event, not a repeat. 01a11cf1 is the comment the session posted as loopway-bot at 19:15:38 (since Let loopway threads sessions act as a GitHub bot user #51, sessions comment as the bot). The webhook sent it as a new issue_comment.created, and the dispatcher handed it over once, like any other comment on the PR. If we don't want sessions woken by their own comments, the dispatcher could skip events whose sender is the configured bot. That would be a separate change.
    2. "marked it done" / "Your 'fix conflicts' event stays open" comes from the old prompt. The session started at 16:32, before the dispatcher restarted on Threads: mark events processed on delivery, let the thread complete #50's code: its first deliveries still say "already locked for you", and from 17:52 on they say "New events for this thread:". The prompt goes in only on a session's first run, and resumes send just the new events. So this session still follows the old "mark it done" instructions. Calling events done on an event that's already processed returns success without changing anything, so it does no harm. Sessions started since the restart get the new prompt and don't call it.

    So the change in #50 is working. Old sessions will keep talking about marking events done until they end. If that's annoying, we could start resumed sessions with a short note saying events are no longer marked done, but I'd rather let them age out.

    The real blocker in that thread is separate: loopway-bot has no write access to craftmilldev/loopway, so PR #54's merge commit can't be pushed.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions