Pi extension: a gated review from the plannotator tool ends 30 s after its tab closes

Closed Beginner friendly
#2,553 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

A pull request for this has already been merged.

  • #2581 by @utpalsinghdev — merged

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend

Research direction

Read plannotator-browser.ts and trace startMarkdownAnnotationSession to see how the Pi extension configures clientLeaseSupported; compare the CLI gate behavior described in the issue. Disable client-lease support for extension-opened reviews, then verify that closing the tab does not stop the review and that the reviewer can still submit or close it.

Written by the indexing model from the issue text.

Description

What happens. The plannotator tool with {"action":"annotate","gate":true} starts the annotate server with
clientLeaseSupported: gate === true && !isRemoteSession() (plannotator-browser.ts,
startMarkdownAnnotationSession). When no tab holds /api/annotate/client-lease for 30 s
(ANNOTATE_CLIENT_LEASE_GRACE_MS), the decision settles as { exit: true } and the server stops. The extension
handles that as "closed", and only shows Annotation session closed.. The agent gets no message, and its list no
longer shows the review.

Why it is a problem. The client lease is there so that the blocking CLI gate (plannotator annotate --gate --json) does not wait forever. The Pi tool does not block: it returns at once, and the decision comes later as a
message. A reviewer who closes the tab, or whose proxy or tunnel drops the stream for 30 s, loses the review, and
the agent does not know.

Steps.

  1. Open a review with the tool and gate: true.
  2. Connect to GET /api/annotate/client-lease, then disconnect.
  3. After about 32 s, the port does not answer, and the agent got no message.

Without gate, the lease route answers 404 and the review stays open.

Why PLANNOTATOR_REMOTE=1 is no fix. It turns the lease off, but it also binds each server on 0.0.0.0
(getServerHostname), gives every review the fixed port 19432 (getServerPorts), so a second review preempts the
first (startServerWithSelfPreemption), turns off the session bridge ("Ask this session"), live app annotation, the
agent terminal, host control, and "Open in", and changes the tool's result text to "open … on your local machine
(forward the port if needed)".

Suggestion. Enable the client lease only for the blocking CLI gate, not for reviews that the Pi extension's tool
opens: clientLeaseSupported: false in startMarkdownAnnotationSession. With that one change, the review stays
open after its tab closes, until the reviewer decides or closes it, on Pi and on OMP.

Version: @plannotator/pi-extension 0.28.21, checked on Pi 1.4.0 and Oh My Pi 18.13.3.

Dominant language
TypeScript
Stars
8.7k
Forks
649
Avg merge
8h 25m
Merged PRs (30d)
761

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from backnotprop/plannotator

All issues in backnotprop/plannotator

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.