Skip to content

Send messages queued after a manual stop instead of holding them - #6255

Merged
ymichael merged 3 commits into
mainfrom
bb/troubleshoot-message-queueing-thr_d2vhpxws6d
Oct 25, 2026
Merged

ymichael merged 3 commits into
mainfrom
bb/troubleshoot-message-queueing-thr_d2vhpxws6d

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

buildFrpcConfig (packages/frp-client/src/config.ts) never set transport.poolCount, so it defaulted to 0 and frps kept no idle work connections for bb connect next. In frp v0.71.0 (the version pinned in packages/tunnel-contract/src/next.ts), server/control.go GetWorkConn handles an empty pool by sending ReqWorkConn and waiting for frpc to dial a connection, which costs an extra round trip. After every take it sends another ReqWorkConn to replenish. frps's vhost HTTP proxy keeps only MaxIdleConnsPerHost: 5, so a burst of more than 5 parallel requests needs new work connections. One example is the web app refetching every active query when a tab resumes. Each of those requests waits a round trip, and the replenish requests then overflow the poolCount + 10 work-conn channel. RegisterWorkConn rejects the extra connections, and frpc logs this as StartWorkConn contains error: work connection pool is full, discarding. The user's server log showed 16–21 of these per burst on 2026-10-23.

What changed

  • buildFrpcConfig now sets transport.poolCount: 10. That is the gate's maxPoolCount (apps/connect-next/src/frps.ts), so frps uses the full value instead of clamping it. frps now pre-requests 10 work connections at login and keeps the pool full, and the channel capacity grows to 20, which covers the bursts we observed. frp multiplexes work connections as streams over the existing control connection by default, so idle pooled connections are cheap.
  • Logging is unchanged. The plugin already forwards every frpc line at info level (packages/frp-client/src/supervisor.ts onLine). Fewer of these lines should appear now, and lowering the level for one benign message doesn't seem worth a special case.
  • No wire or CLI changes.

How you verified

  • pnpm exec turbo run test typecheck --filter=@bb/frp-client --filter=./plugins/connect-next: all passing (frp-client 40 tests; connect-next 28 tests, including frp-e2e.test.ts, which launches the real frps/frpc binaries with the generated config and tunnels requests through it).
  • Updated the exact-config assertion in packages/frp-client/test/config.test.ts.

AGENT GENERATED

🤖 Generated with Claude Code

ymichael and others added 3 commits October 24, 2026 19:57
A message queued while a thread was stopping carried a `stopping` wait and
ran once the stop landed. One queued a moment later, after the thread was
already idle, got `thread-busy` instead, so the manual-stop pause held it
indefinitely even though the user composed it after the stop. Rows created
while the manual-stop pause is in force now carry `stopping` too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The thread composer and the embedded chat chose between two endpoints from
their cached runtime status: the explicit queued-messages create when the
thread looked busy, the send endpoint otherwise. A stale status sent a
message for an idle thread down the queue path, where it could sit behind
the manual-stop pause. Both composers now always submit through send with
queue-if-active, which decides from the server's own state.

The send path already inserted an optimistic queued row and reconciled it
either way. Its prediction now uses the composer's busy predicate, so a
thread that is starting, provisioning, stopping or waiting for its host
still shows the queued row immediately. The embedded chat only toasts
about a queued delivery the composer did not expect.

The now-unused create-queued mutation, its cache transactions and the
client-core request builder are removed. The side-chat plugin and
`bb thread queue create` keep the explicit endpoint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…them

Send to main thread used the queued-messages endpoint, which always adds a
row behind the queue, so a reply sent to an idle or manually stopped main
thread could sit there instead of being delivered. It now uses threads.send
with queue-if-active, the same path the composer uses, so the server
decides whether the reply runs now or waits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit bddf68d into main Oct 25, 2026
48 checks passed
@ymichael
ymichael deleted the bb/troubleshoot-message-queueing-thr_d2vhpxws6d branch October 25, 2026 03:11
mistakeknot added a commit to mistakeknot/aleph that referenced this pull request Oct 27, 2026
…ed thread

The pause check added with get-bb#6255 read the requested thread's id.
When a retired thread redirects to its successor, the message lands on the
successor, so the check must read the successor's id; otherwise a message
queued after the successor was manually stopped got thread-busy and the
automatic drain held it. Upstream has no retired redirect, so this
mismatch came from adapting the pick to the fork. Adds a regression test
for a manually stopped successor.

Bead mk-ooomf.8.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
mistakeknot added a commit to mistakeknot/aleph that referenced this pull request Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant