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

Cerrado Apto para principiantes
#2,554 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Ya se ha fusionado un pull request relacionado.

  • #2581 de @utpalsinghdev — fusionado

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
devtools

Línea de trabajo

Encuentra sendUserMessageWithCurrentSessionFallback y lee cómo elige actualmente entre la sesión de origen de la revisión y la sesión actual. Intenta enviar primero a través de la sesión de origen y usa la sesión actual como alternativa solo si eso provoca un error. Se considera terminado cuando los comentarios llegan al agente de origen de la revisión mientras hay activo un subagente de Oh My Pi, y siguen llegando a la nueva sesión después de /new.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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).

Lenguaje dominante
TypeScript
Estrellas
8.7k
Forks
649
Merge medio
11 h 7 min
PR fusionados (30 d)
862

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de backnotprop/plannotator

Todos los issues de backnotprop/plannotator

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.