Skip to content

First message in a new friend's remote chat is silently dropped #66

Closed

Description

@Birfy

Problem

The first message in a brand-new friend's remote chat is silently dropped: the reply is empty, nothing is forwarded to the friend, and no error is shown. The second message works.

Cause

On the first turn of a new chat, dsh-agent-instructions appends an AGENTS.md baseline message after the user's text:

{ role: 'user', source: { kind: 'agent-instructions', form: 'instructions', baseline: true } }

remoteTurn in core/src/host/remote-chat.js picks the last user message that is not a context snapshot. isContextSnapshot only recognizes form === 'snapshot' and the time-context kinds, so the baseline counts as the last message. remoteTurn then returns { kind: 'none' }, the reply is empty, and forward() is never called. On the second message the baseline is already in history, so the real text is last again and it works.

Notice-form messages (dsh-plan-mode, dsh-repeat-tool-reminder, which use form: 'notice') are the same class of bug.

Repro

remoteTurn([user('hi', { kind: 'user' }), agentInstructionsMsg]) // -> { kind: 'none' }, expected { kind: 'send', text: 'hi' }

Impact

Only the flybot-remote/<handle> model route uses remoteTurn, so @flybot/tree is not affected.

Found while recording the social demo (PR #65).

Fix

Treat the snapshot, instructions and notice forms, and the agent-instructions kind, as context (not a whitelist of user messages). PR to follow. It goes through the patch layer (patches/ds-bot/0005-social-seams.patch), not ds-bot/.

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