Skip to content

πŸ› fix: dashboard chat stops showing replies when a poll request stalls - #15195

Merged
hivecommons-hive[bot] merged 1 commit into
v6from
scanner/fix-15137
Oct 29, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v6from
scanner/fix-15137

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closes #15137

Why

The bot replies (seq 118/120) were already on the server. The browser just stopped asking for them for 99 s.

chatPollMessages lets only one request run at a time. It clears the next-poll timer when a request starts and only re-arms it when that request settles. Two gaps combined:

  1. The poll fetch had no timeout. If one GET stalls (hub proxy, or Safari's per-host connection pool alongside the SSE stream), chatPollInFlight stays true with no timer armed. The channel goes silent until the browser or proxy gives up on the request.
  2. Mid-flight callers were dropped. After POST /api/chat is accepted, chatAskBackend runs await chatPollMessages() to fetch the reply. With a request in flight, that call returned without doing anything. Even when the in-flight request doesn't stall, it may have been sent before the reply existed.

That fits the request log: the last GET was 2 s before the first POST (the next timer poll was due right then), and there was no GET at all for 99 s.

Fix

Base branch

This targets v6. GET /api/chat/messages and the polling client exist only on v6; v5 has no shared chat channel.

Tests

  • TestHiveChatPollRecoversFromStalledRequest runs the real poll slice under node. A poll request stalls while !inception reset is accepted, and the test asserts that the request has a bounded abort, that the queued poll then fetches since=116, that βœ… Inception reset. renders, and that the loop goes back to polling every 2 s. It fails on the old code because there is no abort timer.
  • The overlap assertion in TestHiveChatPollAttributesPeerInputToItsAuthor now expects one request plus one follow-up, instead of one request.
  • I did not run the tests locally (they are blocked in this environment); CI is the check.

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@kanrenibm

Bound each /api/chat/messages poll with a 10 s abort and queue one
follow-up poll for callers that land while a poll is in flight, so a
stalled request can no longer swallow the post-command poll and leave
no timer armed.

Fixes #15137

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: kanrenibm <91967876+kanrenibm@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 29, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: CI pending β€” sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@github-actions

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

Conflicts are checked with every PR merged onto the current tip of v6, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#15194 🌱 Forward-merge v5 into v6 (120 commits) same files src/pkg/dashboard/static/index.html

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the poll slice at the PR head (src/pkg/dashboard/static/index.html:58538-58573) and its callers; this looks correct to me.

  • GET /api/chat/messages returns immediately (src/pkg/dashboard/api_chat.go:228-253 β€” DashboardChatPoll(since) then jsonResponse, no long-poll), so a 10 s AbortController deadline cannot cut off a legitimate response.
  • The chatPollQueued flag is reset at the top of the next run (:58546) and only consulted after again (:58569-58570), so the epoch-reset retry subsumes the queued follow-up instead of issuing a third request, and overlapping callers still never fetch in parallel. An abort lands in the existing catch β†’ chatNotePollFailure β†’ backoff path.
  • The caller at :58212 (await chatPollMessages() after an accepted /api/chat) already tolerated an early return, so the queued path does not change its contract.
  • TestHiveChatPollRecoversFromStalledRequest exercises the real slice via the node harness; the final scheduled[...] === CHAT_POLL_OPEN_MS assertion holds because the queued poll's success resets chatPollFailures after the abort increments it.

Dashboard test shards are green on this head.

β€” hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed β€” no findings from this perspective.

β€” hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed β€” no findings from this perspective.

β€” hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed β€” no findings from this perspective.

β€” hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the poll slice at base (src/pkg/dashboard/static/index.html:58534-58571) and the node harness that extracts it. The change looks correct to me.

What I verified:

  • The abort path lands in the existing catch β†’ chatNotePollFailure() β†’ finally, so an abandoned request takes the same backoff as a non-2xx, and clearTimeout(abortTimer) runs on every exit (index.html:58567). The follow-up poll then resets chatPollFailures = 0 on success, which is why the test's last scheduled delay is CHAT_POLL_OPEN_MS.
  • chatPollQueued is declared inside the slice the harness lifts (chat_outbox_cursor_test.go:16, between chatRenderOutbound and the Device Flow comment), and CHAT_POLL_TIMEOUT_MS is supplied by the harness prelude β€” so the test runs the real production function, not a copy.
  • When again and chatPollQueued are both set, the retried call resets chatPollQueued = false on entry and its fetch uses the updated since, so the queued caller's request is still covered by a later fetch. No parallel requests are introduced; the #9135 single-flight invariant holds.
  • chatAskBackend already uses the same AbortController pattern (index.html:58197), as the body says.

Minor, not a blocker: the queued follow-up runs even if document.hidden flipped true mid-flight (chatSchedulePoll is the only hidden-tab guard). That is at most one extra GET per hide, so I would not change it.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 4d3a2a2 into v6 Oct 29, 2026
86 of 91 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-15137 branch October 29, 2026 00:53
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#151959bde252` sha256:61893732d41a4f174b30d939fb6ec53dd3f0ff226c681245730e90c0e60d2895 β€” download from the dashboard or `hivectl review evidence #15195`.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. hacktoberfest hacktoberfest-accepted size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› bug: dashboard chat UI stops showing bot replies after sending a command

1 participant