Skip to content

feat(chat): monitor reply quotes and a session-start DM ensure (TASK-4043) - #2309

Merged
xarmian merged 7 commits into
mainfrom
wren/task-4043-monitor-delivery
Oct 25, 2026
Merged

xarmian merged 7 commits into
mainfrom
wren/task-4043-monitor-delivery

Conversation

@xarmian

@xarmian xarmian commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

Chat 2a.6, monitor delivery (TASK-4043). #2305 (TASK-4041) shipped most of this task's body. This PR adds the two pieces it didn't ship: the reply quote in the monitor line, and a session-start owner-agent DM ensure.

Already on main (82f81ee). Each body bullet with its evidence:

  • chat=true on the stream: internal/cli/client.go:949. Agent and worker headers: internal/cli/client.go:3041 and :3045. The monitor runs pad watch --stream --for-session (plugin/scripts/pad-monitor.sh:119).
  • GET with the session's own credential: cmd/pad/cmd_watch_chat.go:35. Membership is re-checked server-side on every read (internal/server/handlers_chat.go:193).
  • One line, whitespace collapsed, a 2000-rune cut with a pad chat show pointer: cmd/pad/cmd_watch_chat.go:89, :96.
  • Dedupe by message id (cmd/pad/cmd_watch_chat.go:130) and delivered_seq ack (:65).
  • The /me/chat/unread summary on reconnect or sync_required: cmd/pad/cmd_watch_chat.go:75, :408, and cmd/pad/cmd_watch.go:630.
  • The three named tests: cmd/pad/cmd_watch_chat_test.go:98 (TestFormatChatLineEnvelopes), :160 (TestMonitorDedupeAndDeliveredAck), :243 (TestReconnectPrintsUnreadSummary).

New in this PR

  • The quote as reference plus excerpt only. A reply renders (replying to #<seq>: "<excerpt>") from the server's ConversationQuote. The quoted body is never fetched or printed. The quote is collapsed, appended outside the 2000-rune cut, and omitted when it is nil or deleted. It appears in both framings.
  • Ensure the owner-agent DM at session start (the TASK-4039 carry-forward: the call is uncharged when the DM exists). It runs once per monitor process after chat identity resolves, in the background. It never blocks or fails the session and never writes stdout. On 429 it waits Retry-After and retries, with at most 3 attempts. A 0, negative, absent or overflowing Retry-After waits a 120s default. Any other error is not retried. A failure outcome writes one stderr line.
  • Prose updated in pad watch help, docs/api.md, skills/pad/SKILL.md, plugin/skills/pad/SKILL.md and plugin/skills/connect/SKILL.md.

Not in scope: Dave's requirement that chat be visible to the human at the terminal is TASK-4071, which is blocked by this one.

Evidence: 15 of 15 mutants were killed at the committed head. The CONVE-190 gate set passed (gofmt, lint, guards, full go test ./...). Four review rounds.

https://claude.ai/code/session_017ofcsFmgnoVDPxeHwuxCjg

…43 r2)

A Retry-After too large for a time.Duration (>= 9223372037s) wrapped
negative and made the ensure retry hot. Seconds are now bounded before
the multiply; zero, negative, absent and overflowing values all wait
the 120s default, and the largest value that fits is honoured.

Claude-Session: https://claude.ai/code/session_017ofcsFmgnoVDPxeHwuxCjg
…43 r3)

The overflow rows are int64 and skip where int cannot hold them; the
rows run with a temp HOME.

Claude-Session: https://claude.ai/code/session_017ofcsFmgnoVDPxeHwuxCjg
@xarmian
xarmian marked this pull request as ready for review October 25, 2026 02:52
@xarmian
xarmian merged commit bc2a328 into main Oct 25, 2026
12 checks passed
@xarmian
xarmian deleted the wren/task-4043-monitor-delivery branch October 25, 2026 02:55
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