cli ask: print console URL and render the agent's response - #17
Merged
Conversation
The durable-thread server acks the websocket chat request with an immediate empty done sentinel, so the old WS wait resolved instantly with no text: the command printed a bare thread id and exited without ever showing the agent's answer. thread ask now sends the prompt via POST /messages (async, 202) and polls the thread until it is idle (runningSince/awaitingAgentsSince null) with an assistant reply, then renders the reply text. The bare thread id is replaced by the thread's console URL (_html_url, with a slug-based fallback). --stream prints the reply incrementally from the in-progress persisted message; the poll gives up after 10 minutes and points at the console URL instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017dH9CyqJdQDNAnyS5Tg2L8
|
Warning Polylane could not verify the production impact of this pull request. Checked the CLI polling changes against nominal-api-threads-prod (254 req/h, 0 errors); this is a client-side npm tool, not a deployed resource, and the polling hits existing endpoints the console already uses at trivial volume. Dependency changes
Polylane could not find the cloud resources this repository manages, so this review looked at the entire cloud account. Connect this repository to its resources and the next review will focus on exactly what this code deploys to. Polylane analysed |
Rewire thread continue onto the same async-send + poll path as thread ask: post via messages.post, print the console thread URL on stderr, and poll with waitForAssistantReply until the agent's reply lands. Pre-existing messages are excluded via a new ignoreIds option so only the new turn's reply is rendered; the poller now reads the newest page of messages so long threads see fresh replies. The old durable-thread WebSocket path resolved on the request ack (an empty done sentinel), so continue printed nothing. With continue migrated, thread-chat.ts had no callers left — removed along with the ws dependency. threadConsoleUrl moved to a shared module used by both ask and continue. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017dH9CyqJdQDNAnyS5Tg2L8
thread ask and thread continue now print the reply incrementally in text mode without needing --stream. Piped stdout still auto-selects json, and --output json still waits for the complete reply. The --stream flag is kept as a deprecated no-op so existing invocations keep working. The spinner shows until the first token arrives. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017dH9CyqJdQDNAnyS5Tg2L8
boristane
approved these changes
Aug 10, 2026
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.
Requested by boris · Slack thread
Before
polylane thread ask "…"printed a bare thread id and exited. The answer never appeared: the durable-thread server acks the CLI's WebSocket chat request with an immediate emptydonesentinel, so the old wait resolved instantly with empty text.polylane thread continuehad the same bug via the same WebSocket path.After
The command prints the console URL for the thread and then actually shows the agent's answer in the terminal:
thread continuenow behaves the same way: console URL on stderr, the new turn's reply on stdout (prior messages in the thread are excluded from the rendered reply).--streamis kept as a deprecated no-op.--output json(and piped stdout, which auto-selects json) waits for the complete reply and emits{ thread: { id, name, url }, status, text, messages }— nothing is lost."status": "pending"with any partial text).--no-waitoutput now includes the URL alongside the id.How
Thread creation and message dispatch are async server-side, so the CLI now sends the prompt via
POST /v1/messages(202 accepted) and pollsGET /v1/threads/{ws}/{id}until the thread is idle (runningSinceandawaitingAgentsSinceboth null — the same signal the console's threads table uses for "Completed") with an assistant reply, then fetchesGET /v1/messages/{ws}/{id}and renders the text parts. The console URL comes from the thread's_html_url(already returned by the API), with aworkspacesGetslug-based fallback. Poll interval 2s, timeout 10 minutes; a brief idle flicker between agent iterations is tolerated by requiring several consecutive idle polls before accepting a reply without text. The helper lives insrc/client/thread-poll.tswith tests intest/thread-poll.test.ts.thread continue— originally noted here as a same-bug follow-up — is now fixed in this PR too: it rides the same poll helper with a newignoreIdsoption (messages that existed before the send are excluded, and the poller reads the newest page so long threads see fresh replies). With continue migrated, the old WebSocket path (src/client/thread-chat.ts) had no callers left, so it and thewsdependency are removed. The shared console-URL helper moved tosrc/commands/thread/console-url.ts.🤖 Generated with Claude Code
https://claude.ai/code/session_017dH9CyqJdQDNAnyS5Tg2L8
Generated by Claude Code