Skip to content

feat(monitor): auto-complete monitor tasks from the user's own messages#397

Draft
seasidespace wants to merge 1 commit into
berabuddies:masterfrom
seasidespace:feat/monitor-self-report-completion
Draft

feat(monitor): auto-complete monitor tasks from the user's own messages#397
seasidespace wants to merge 1 commit into
berabuddies:masterfrom
seasidespace:feat/monitor-self-report-completion

Conversation

@seasidespace

Copy link
Copy Markdown
Contributor

Summary

Auto-completes a monitor-created task when the user later does the thing and says so in the same conversation, by watching their own outgoing Telegram messages.

  • When a monitor task exists for a chat, outgoing self-messages in that chat are judged for completion intent (e.g. 拿了 / 搞定了 / done); a confident match flips the matching task to completed with completed_via:"self_report".
  • 省token: an LLM call only fires when the conversation actually has an open monitor task — a cheap task-store gate runs first and returns with zero tokens otherwise.
  • 不影响性能: the normal incoming-message triage path is untouched. Outgoing self-messages are emitted on a dedicated message_self kind and short-circuited in the router before triage, preserving the #569 "self-messages never trigger triage" guarantee.
  • The completion judge uses the monitor's configured model (routed via the workflow runner's new complete_text), not a hardcoded model.
  • Completion phrases = built-in multilingual defaults + per-monitor configurable, passed to the model as hints (never a hard gate). Multiple open tasks in one chat → the model disambiguates which task.
  • New RPCs: monitor_completion_phrase_add / monitor_completion_phrase_delete.

Test plan

  • cargo check -p puffer-subscriptions -p puffer-cli
  • cargo test -p puffer-subscriptions self_report (4 passing: self-message detection by kind/payload, remote handler)
  • cargo test -p puffer-cli monitor_self_report (11 passing: zero-token gating, single/multi-task judging, phrase-hint merging, completed/ignored tasks excluded)
  • outgoing message_self kind mapping test
  • Manual e2e: create a monitor task from an incoming message, send a self-message "搞定了" in the same chat → task shows completed (completed_via:"self_report"); unrelated self-message does not complete it; self-message in a chat with no open task makes zero LLM calls.

🤖 Generated with Claude Code

When a monitor creates a pending task from an incoming Telegram message,
keep watching the user's OWN outgoing messages in that same conversation.
If the user signals they did the thing ("拿了"/"搞定了"/"done"...), the
matching monitor task is auto-marked completed (completed_via:"self_report").

Design constraints honored:
- 省token: an LLM call only fires when the conversation actually has an open
  monitor task (cheap task-store gate runs first; zero tokens otherwise).
- 不影响性能: the normal incoming-message triage path is untouched. Outgoing
  self-messages get a dedicated `message_self` kind and a router short-circuit
  that skips triage entirely (preserves the #569 no-self-triage guarantee).
- The completion judge uses the monitor's configured model (not a hardcoded
  one), routed through the workflow runner's new complete_text.
- Completion phrases (built-in multilingual defaults + per-monitor configured)
  are passed as hints to the model, never as a hard gate. Disambiguation asks
  the model which task when a conversation has multiple open tasks.

New RPCs: monitor_completion_phrase_add / _delete.

Tests: self-report detection, zero-token gating, single/multi-task judging,
phrase-hint merging, and the outgoing message_self kind mapping.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

@seasidespace is attempting to deploy a commit to the fuzzland Team on Vercel.

A member of the Team first needs to authorize it.

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