fix(plugin/tether): don't drop replies on async parse; add ask (email-and-wait)#355
Merged
Conversation
…il-and-wait) Two fixes surfaced by a live run: 1. Parse-race reply loss. `poll` advanced a time-cursor to "now" on every call, so a reply picked up in the brief window before e2a finished parsing it (empty parsed/body) was skipped permanently — a real emailed question was lost. Replies are now deduped by message-id (a `seen` set) and the watermark only advances through the contiguous processed prefix; an unparsed message is retried (up to a max age), never dropped or repeated. 2. Questions stalled the session. An AFK user can't answer a terminal prompt, so any agent question would hang tether. New `tether.sh ask "<q>"` emails the question into the thread and blocks until the reply, then prints the answer. SKILL.md makes it a rule: while tethered, ask by email, never the terminal — and documents that CLI permission prompts must be pre-authorized (an emailed reply can't answer them; the Notification hook remains the alert). Bumps plugin to 0.4.3 across all manifests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #354, from a live run of the harness.
1. Parse-race reply loss (bug)
e2a parses inbound email asynchronously — a just-arrived reply briefly has empty
parsed/body, then populates. The oldpolladvanced a time-cursor to "now" every call, so a reply caught in that window was skipped permanently (a real emailed question was silently lost in testing).Fix: dedup by message-id (a
seenset in state); thelast_pollwatermark only advances through the contiguous processed prefix, and an unparsed message is retried (until a max age) rather than skipped. Replies can no longer be dropped or double-delivered.2. Questions stalled the session (the AFK problem)
An AFK user can't answer a terminal prompt, so any agent-initiated question (AskUserQuestion / bare prompt) would hang tether.
Fix: new
tether.sh ask "<question>"— emails the question into the thread and blocks until the user replies, then prints the answer. SKILL.md makes it the rule: while tethered, every question goes over email, never the terminal. For permission prompts (which an emailed reply can't answer natively), the guidance is to pre-authorize the session; theNotificationhook stays as the alert/safety-net.Testing
install.sh _selftestgreen (syntax + unconfigured no-op).curl: unparsed reply is retried not consumed → delivered once when parsed → never repeated (seen=['msg_r1']).ask: sends question, blocks, returns the emailed answer.validate-plugin.mjs: 3 skills, version 0.4.3, manifests in sync.Bumps plugin to 0.4.3.
🤖 Generated with Claude Code