Skip to content

fix(amicode-service): reconcile re-opens the dead LOCAL fan-in arm (#1601) - #1602

Merged
jeonghun-jj-lee merged 1 commit into
feature/free-tier-fleetfrom
amico/issue-1601-fanin-local-arm
Sep 28, 2026
Merged

jeonghun-jj-lee merged 1 commit into
feature/free-tier-fleetfrom
amico/issue-1601-fanin-local-arm

Conversation

@jeonghun-jj-lee

Copy link
Copy Markdown
Contributor

Closes #1601.

What

FanInConnection.reconcile() now re-opens the LOCAL fan-in arm when it is
absent from this.sources — idempotently, resuming from the LOCAL namespace's
live cursor, mirroring start().

Why (the freeze)

On a role: server machine with ≥1 serving peer, the webview's GET /global/event
runs through SseFanInDriver, which fans in a LOCAL arm (→ local engine) plus
peer arm(s). start() opened the LOCAL arm once; pump() removes any dead
source (LOCAL included) when its upstream ends; but reconcile() only iterated
agg.activeArms(), which is peers-only by construction ([...peerArms],
never local). So once the LOCAL upstream ended, the LOCAL arm was never
restored until a full webview reload — while peer frames kept the composite
stream non-silent, so the client stream-liveness watchdog (#1584) never fired.
Result: local chat sessions freeze / go stale until a window reload (#1583,
Problem B — event delivery). This is server-side; #1587 (client watchdog) was
necessary but insufficient, and #1594 (engine lifecycle, Problem A) is unrelated.

The fix

13 lines in reconcile(), appended after the peer close loop: guarded on
!this.sources.has(LOCAL_NAMESPACE), calling openArm(LOCAL_NAMESPACE, localEventUrl(), authHeader, resume.get(LOCAL_NAMESPACE)). No change to
start(), pump(), openArm, peer-arm behavior, or the aggregator; the
downstream res is never ended.

Tests

New describe("#1601 …") in sse_fanin_driver_pump.test.ts (mirrors the #1566
peer-arm test for the LOCAL namespace): asserts the LOCAL arm opens once, a
pre-drop frame is delivered, the arm is re-opened after its upstream ends +
reconcile(), a post-reopen frame is delivered, the downstream res is never
ended, and fleet-of-one idempotence (a healthy LOCAL arm + no peers is never
re-opened/duplicated across repeated reconcile ticks). RED before the fix (arm
not re-opened → expected 1 to be 2), GREEN after.

Gates (all run locally on this branch)

Base is feature/free-tier-fleet (not main). Draft until a human reviews;
merge is human-only.

@jeonghun-jj-lee
jeonghun-jj-lee marked this pull request as ready for review September 28, 2026 01:40
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 69a54a15-9caf-4d23-932d-79de2de90bc8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jeonghun-jj-lee
jeonghun-jj-lee merged commit 23e7456 into feature/free-tier-fleet Sep 28, 2026
11 of 12 checks passed
@jeonghun-jj-lee
jeonghun-jj-lee deleted the amico/issue-1601-fanin-local-arm branch September 28, 2026 02:09
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