Repository navigation
feat(agent): message people as an agent — connect, ask, replies and a signed webhook - #163
xergioalex wants to merge 4 commits into
Conversation
… signed webhook dailybot agent connect mints an agent credential with the login session and stores it in messenger.json (0600, token never printed). agent ask asks one person (options for a one-tap decision, --wait to block for the answer; exit 124 on timeout), agent replies returns new answers with a stored cursor, and agent webhook set/show/remove manage the signed webhook. The older API-key agent webhook and message commands are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AY6kxNxkCZG2pPJSh1Bxer
connect explains a name owned by someone else (409 name_taken, exit 2) and a paused agent (403); replies asks for full pages (limit 50) and documents that a first call returns the last 7 days. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AY6kxNxkCZG2pPJSh1Bxer
The API nests the agent as agent.participant {id, display_name}; connect now
stores and shows the real agent id and name, agent me renders the same shape,
and ask checks options locally (unique, at most 80 characters).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AY6kxNxkCZG2pPJSh1Bxer
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
- A replies page that does not move the cursor ends the drain (agent replies) or pauses the wait (ask --wait), so a repeated page is never replayed. - ask --wait first catches up to the newest reply, so a long backlog never eats the wait; a question without question_id is refused under --wait. - The stored credential matches an equivalent API origin (case, default port). - A cursor write never restores a token that connect replaced meanwhile. - --follow with --wait is a usage error; a bad .dailybot/profile.json answers in JSON under --json. - messenger.json is listed with the files that hold secrets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI review for
|
There was a problem hiding this comment.
Code review — 0 finding(s): 0 critical · 0 warning · 0 info
Check: ✅ passing — strictness block-on-critical: highest severity none ≤ critical threshold
No findings posted inline.
Summary
Verdict
Solid follow-up — all nine open findings from the prior review are fixed, with tests covering each failure mode.
What this round fixed
The 7fb9fcb commit closes the messenger review items end to end:
- JSON mode on repo-profile errors —
_profile_slugtakesjson_modeand routesRepoProfileErrorthrough_fail(every messenger command passes it). - Host binding — credential vs current API uses
same_api_origin(scheme + lowercased host + default ports), matching login-token binding. - Cursor / drain safety —
_wait_for_answerand_fetch_newonly advance whennext_cursoris non-empty and different from the request cursor; a non-moving page pauses or ends the drain instead of spinning or replaying forever. ask --waitbacklog —_head_cursordrains to the head (without moving the stored cursor) before the ask, so the wait window does not replay up to seven days of unrelated replies.- Missing
question_id— with--wait, an ask response without an id fails withinvalid_responseinstead of matching empty-id replies. - Connect vs long-poll race —
set_messenger_cursor(..., token=...)refuses to write when the on-disk token no longer matches the poller. --follow+--wait— exclusive flags, exit 2 /invalid_flags.- Docs —
messenger.jsonis listed in Rule 11 anddocs/SECURITY.md.
Residual notes (not blocking)
save_messenger_credential still preserves the cursor with string api_url == api_url while runtime binding uses same_api_origin. Reconnecting with an equivalent host form (e.g. :443 / different case) would reset the replies cursor. Rare and mild; worth aligning when convenient.
No new critical or warning findings on the incremental hunks. Credential isolation (Authorization: Agent only, host-bound token, 0o600 store) still looks correct.
Recommendation: approve
Since last review (3d4af5a → 7fb9fcb): resolved 9 · still open 0 · regressed 0 · new 0 · 9 auto-retired (fix corroborated; thread already collapsed).
Prior findings
- retired
dailybot_cli/commands/agent_messenger.py:501(verified_fixed) - retired
dailybot_cli/commands/agent_messenger.py:395(verified_fixed) - retired
dailybot_cli/commands/agent_messenger.py:162(verified_fixed) - retired
dailybot_cli/commands/agent_messenger.py:468(verified_fixed) - retired
dailybot_cli/commands/agent_messenger.py:484(verified_fixed) - retired
dailybot_cli/commands/agent_messenger.py:138(verified_fixed) - retired
dailybot_cli/config.py:1719(verified_fixed) - retired
dailybot_cli/commands/agent_messenger.py:592(verified_fixed) - retired
dailybot_cli/config.py:1642(verified_fixed)
Check status: ✅ passing — strictness
block-on-critical, highest severity in effectnone: highest severitynone≤ critical threshold.This line is written by the reviewer runtime after the gate ran and matches the check conclusion and the tracking comment. Any recommendation above is the model's advisory opinion, not the gate.
What
An agent can now message a person through Dailybot and read the answer — "use Dailybot to message me" just works.
dailybot agent connect "<name>" [--description] [-p]— needsdailybot login; mints an agent credential (dbagt_…) and stores it in~/.config/dailybot/messenger.json(0600, per profile). The token is never printed, only its prefix. Same name again → same agent, fresh credential.dailybot agent me— the agent behind the stored credential.dailybot agent ask --to <email|usr_id> "<text>" [-o X ...] [--wait 30m] [--json]— 2–6 options for a one-tap decision;--waitlong-polls replies for thatquestion_id.dailybot agent replies [--wait] [--follow] [--json]— new answers since the last call (cursor stored per profile;--followstreams JSON Lines).dailybot agent webhook set <https-url>/show/remove— signed webhook; the secret is shown once.Decisions
Authorization: Agent <token>, never an API key or the login session, and only to the API host that minted the token.connectsends only the login session (the API key is not even a fallback, so a refusal names the real problem).webhook register/unregisterkeep the older API-key flow unchanged;set/show/removeare the messenger webhook. No behaviour switches on what the profile holds, so neither command changes meaning under an existing script.timeout(1)convention.ask --waitreads from the stored cursor without moving it, soagent repliesstill lists every answer.messenger.jsoninstead of new keys inagents.json(Rule 16: stored schemas untouched).Contract (API built in parallel)
POST /v1/messaging/agents/connect/,GET /agents/me/,POST /agents/me/ask/({person, text, options?}),GET /agents/me/replies/?after=&wait=,GET/PUT/DELETE /agents/me/webhook/; errors use the messaging envelope{code, message, detail, retry_after, request_id}. Documented indocs/API_REFERENCE.md.Tests
tests/agent_messenger_test.py(38): storage mode and cursor rules, wire (Agent scheme, no fallback, connect never sends the key, wait clamp/timeout), every command incl. not-v4, revoked credential, rate limit, timeout exit, terminal-safe reply text. Full suite: 4352 passed; ruff check/format and mypy clean.CHANGELOG is generated by semantic-release from the
feat:commit, so it is not edited by hand.🤖 Generated with Claude Code
https://claude.ai/code/session_01AY6kxNxkCZG2pPJSh1Bxer
Carries the commits of #161 by @mauriciomdb, reopened from a maintainer account so the AI review gate runs.