Skip to content

Keep IM routing through harness metadata and active goal continuations - #1768

Closed
tianmazi wants to merge 2 commits into
Fei2411:devfrom
tianmazi:fix/1767-im-context-snapshots
Closed

tianmazi wants to merge 2 commits into
Fei2411:devfrom
tianmazi:fix/1767-im-context-snapshots

Conversation

@tianmazi

@tianmazi tianmazi commented Nov 17, 2026 •

Copy link
Copy Markdown

Issue

Fixes #1767

An IM request correctly claims its reply chat, but DSH emits runtime/time snapshots and model-selection notices as user/message records. DS Bot treated those harness records as another user's input and silently cleared the IM origin. A later automatic goal check had the same effect, so long-running group progress stopped reaching Feishu even after ordinary replies and pictures worked.

What changed / 改了什么

  • Ignore only runtime-context/time-context with form: snapshot, and model-selection with form: notice, before consuming the pending group reset.
  • Treat an internal bot/relay/goal nudge as a continuation only when its room ID and goal ID match the same currently active group goal. Like a late member post, it can preserve an existing origin but cannot invent a destination or revive a mixed turn.
  • Keep draft/resume goal events, unknown forms/kinds, stale or completed goals, other rooms, Web/phone user input, unpairing and rebinding subject to the existing fail-closed rules.
  • Add a direct/group matrix for metadata before/after the IM input and dedicated active-goal continuation/boundary cases.

This does not upload images; the separate local-image pipeline is #1765. It also does not reconstruct origins after a restart or backfill previously omitted messages.

Changelog

Harness metadata and automatic checks of the same active goal no longer silently stop IM replies and later group progress.
Harness 系统上下文、模型切换通知及同一活动目标的自动检查不再导致 IM 回复和后续群聊进度被静默跳过。

How I checked it / 怎么验证的

  • All IM host tests: 81 passed on Node 24.22.3 with the isolated npm DSH 0.2.2-rc.1 test harness.
  • Initial snapshot regression: 8 of 9 focused cases fail against original dev; all 9 pass after the initial fix.
  • Follow-up reproduction: 5 of 13 new model-notice/goal cases fail against the initial snapshot-only patch; all pass with the follow-up. The combined 22 metadata/goal cases pass.
  • node scripts/build-client.mjs --check, npm run lint (existing warnings), git diff --check.
  • Reporter confirmed a real Feishu picture arrived after applying the initial origin fix with the local media/card patches. Subsequent persisted-event analysis identified a model notice and active-goal nudges as the additional long-running-progress failures. Follow-up live validation remains pending after reload/new IM input.
  • Full suite on this branch / bench smoke: not claimed. A sibling media-branch full run has four connector-gateway failures; the repository-wide checks are not green.
  • Screenshot: no DS Bot interface change.

Checklist / 检查

  • One issue: retain valid IM reply ownership through internal continuation records.
  • No client source/generated client change.
  • No real conversations, IDs, snapshot text, paths, credentials or images included.
  • Human commit author; no AI-tool author/co-author.

Draft from the reporter's fork, subject to the repository's collaborator-only contribution policy.

Runtime and time snapshots are user/message events but are not user input. Ignore only those known snapshot forms before classifying reply ownership, keeping real mixed-source turns blocked.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Ignore only the harness model-selection notice and recognize matching active-goal nudges as group continuations. Keep unknown, stale, mismatched, and user-originated goal events local.
@tianmazi tianmazi changed the title Keep IM replies routed across Harness time and runtime snapshots Keep IM routing through harness metadata and active goal continuations Nov 17, 2026

@Fei2411 Fei2411 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: COMMENT — recommend closing in favour of #1750; please port the tests.

  • The fix only ignores DSH's runtime-context/time-context snapshots. DS Bot's own snapshots (ds-bot-time-context in time-context.js:42, and ds-bot-memory-recall/ds-bot-memory-update/group memory in memory.js:919/932/962, all form: 'snapshot' on dev) still drop the origin, so #1735 stays partly broken. The new test { kind: 'unknown-context', form: 'snapshot' } actually pins that behaviour.
  • #1750 returns early for any form === 'snapshot' at the same spot, so it is a superset of this fix.
  • The test matrix is the best part of this PR: before/after × direct/group, 8 cases, all passing on dev a95e3af (2906/0). Porting it onto #1750 (dropping the unknown-context snapshot case, or flipping it to expect delivery) would close the group-Session gap in #1750's tests.
  • #1765 says it depends on this PR. It should rebase on #1750 instead.

@Fei2411

Fei2411 commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thanks for the fix, @tianmazi! #1750 covers the same IM reply problem (#1767/#1735) in one change, so closing this one in its favor.

@Fei2411 Fei2411 closed this Nov 19, 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.

2 participants