Skip to content

After the sync service comes back, Enter replays the cached 'has not answered' instead of trying again #2580

Open

Description

@AbirAbbas

What happened

After the sync service comes back from an outage, Enter in a chat keeps answering with the cached failure:

<host> has not answered; your message is still in the box, press enter to send it

That lasts until Home's next machine reading lands, which was tens of seconds in a two-computer hand test. In that
test Enter 5 s after the service returned still did not send; Enter about a minute later sent at once. The words are
kept and nothing is written, but the person is told the service has not answered when it now would.

The code path is the same on app/v3 a687c92 and the idle hand-off branch (#2287).

Replication

Deterministic (no model).

  1. make build and go build -o modelstub ./test/remote/stub. Run a local sync service
    (bin/codeaf relay --listen <address> --store <folder>) and the stub.
  2. Make one throwaway home with CODEAF_SYNC_URL=<address>, CODEAF_BASE_URL=<stub address>/api/v1,
    OPENROUTER_API_KEY=stub, and paired with a second throwaway home so sync checks are on.
  3. Open a chat on home A and send one message. Stop the sync service and wait until Home says it is unreachable.
  4. Start the sync service again. Within 5 s, type a message in the chat and press Enter.
    • Today: … has not answered; your message is still in the box, until the next machine reading.
    • Expected: Enter probes the service again and sends.

Where

checkBeforeSendWith in internal/tui3/homepanel_heldelsewhere.go (search
offline := a.machineRead.down && !readTimedOut(a.machineRead.err)): a cached connection-refused reading is replayed
without a fresh probe. Readings are asked by askMachines in internal/tui3/homepanel_machines.go.

The fix

A person's Enter asks again: a refused cached reading triggers one bounded fresh probe (a few seconds) before the send
is refused. The standing "unreachable" line on Home can keep its own cadence.

Acceptance

  • e2e: the replication above. Enter 2 s after the service returns sends the message.
  • e2e: the control. With the service still down, Enter answers within the probe bound and keeps the words.
  • Unit: a cached refused reading plus Enter issues exactly one fresh read before deciding.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions