Skip to content

ctx.flybot host API: change-seq reset, MCP client timeouts, reserved names (PR #2 review) #18

Closed

Description

@Birfy

Context

The PR #2 review listed several P2 robustness gaps in the host ctx.flybot service and the social MCP client. They are spot-checked as still present at 7b806c6 (for example, changeSeq is still an in-process counter, src/host/hooks.js#L86-L89). Related to #4.

Original feedback (@hsliuustc0106, permalink, P2)

  • State/persistence: "changeSeq resets per process while the browser watermark never regresses → field events silently stop after every host restart". In addition, the corrupt-fields reset in store.js does not set migrated, and change.value gives listeners the stored object, so a listener that mutates it diverges memory from disk.
  • MCP client: "no timeout/AbortSignal anywhere (a hung server stalls polling, transport, and approvals.decide indefinitely), and it advertises text/event-stream in accept but would crash parsing an SSE response."
  • API surface: "api.handle silently accepts built-in names (approvals, decide, …) that the endpoint switch shadows — reject them. flybot.scope('shared') is allowed and collides with the unscoped namespace."

Proposed fix

  • Add a per-process epoch to change events (or persist changeSeq), and have the client reset its watermark when the epoch changes.
  • Set migrated on reset. Deep-clone or freeze change.value.
  • Add a timeout or AbortSignal to every MCP call. Either handle SSE or stop advertising it.
  • Reject reserved endpoint names and the shared scope.

Acceptance criteria

  • Field events keep flowing to an open browser after a host restart.
  • A hung MCP server causes a timeout error, not a stall.
  • handle('approvals') and scope('shared') throw.
  • Tests cover each case.

Refs: PR #2 (merged), umbrella #3. Verified against Birfy/FlyBot flybot-plugins tip 7b806c6.

Activity

  1. added a commit that references this issue on Oct 14, 2026
    d272186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions