Skip to content

Pi extension on Oh My Pi: review feedback goes to an in-process subagent #2554

Closed

Description

@instant-agent99

What happens. OMP runs task subagents in the same process, and loads each extension again for each subagent.
Each instance calls registerCurrentPiSession(pi) as it loads, and currentPiSession.update(ctx) at
session_start, so the latest subagent becomes globalThis.__plannotatorCurrentPiSession.current.
sendUserMessageWithCurrentSessionFallback first tries sendUserMessageToCurrentPiSession, and sends there when the
current session's runtime token is not the review's origin. Review, annotate, and last-message feedback that a
person sends while any subagent is live so goes to the subagent, with the header "This Plannotator feedback was
submitted from a browser tab opened before Pi switched sessions". The agent that opened the review gets nothing.
After OMP disposes of the subagent (its session_shutdown clears it), feedback goes to the right session again.

Steps. On OMP 18.13.3:

  1. Open an annotate review with the plannotator tool.
  2. Run one task subagent and let it finish. It stays idle in memory for task.agentIdleTtlMs, 7 min by default.
  3. Send feedback from the review's tab. The subagent's conversation gets it.

Suggestion. Try the origin's own pi.sendUserMessage first, and fall back to the current session only when it
throws. Pi makes a replaced session's pi throw ("This extension ctx is stale after session replacement or
reload"), so the /new, /resume, and fork case still reaches the current session through the existing catch.
This is one deleted line, the first trySendUserMessageToDifferentCurrentSession call in
sendUserMessageWithCurrentSessionFallback, and it needs no knowledge of subagents. With it, feedback reaches the
agent that opened the review while a subagent lives on OMP, and a tab opened before /new on Pi still delivers to
the new session once.

Version: @plannotator/pi-extension 0.28.21, checked on Oh My Pi 18.13.3 (Pi 1.4.0 has no in-process subagents).

Activity

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