connect: admit boosts on the agent's own posts as a boosted trigger

Merged
JE
2mo ago
+749-54

Problem

Someone boosts a comment, Campfire line or post the agent wrote, and the agent never hears about it. Basecamp does deliver the boost: Boost#track_boost_event tracks a boosted event on the boosted recording, and Event::Addressees addresses it (reason boosted) to the boostee. But basecamp connect's admission matrix only knew mentioned, subscribed, assigned and completed, so boost.created was discarded as not_in_matrix. People boost an agent's question and wait, and the agent waits too.

Card: https://app.basecamp.com/2914079/buckets/46292715/card_tables/cards/10396224165

Change

boost.created now admits under a new boosted trigger (internal/connector/admission/matrix.go, boost.go, verdict.go):

  • Addressing. A boost is admitted only when it is on the recording itself and the recording's creator is the agent. A boost on someone else's recording is discarded as not_addressed.
  • Trust. The booster is gated like a mention's performer, in every trust mode, and the rule is not OperatorOnly. That means the operator and allowlisted people as operators, and project members (after the membership read) as participants. Someone outside the trust set is discarded at the gate, before any read. The agent's own boosts are discarded as agent_authored. So are other agents' boosts on the push lane. Delegated boosts are discarded as delegated. An --allow-agent agent gets in by mention only, so its boosts are discarded as not_addressed. Two agents that allow each other can't boost each other into a loop.
  • Reads. boost.created names no recording type, and the SDK's Summarize refuses to route it (ErrNoRecordingType). So the boost is read first (GET /boosts/:id, a new Reads.Boosts). That read gives the boosted recording's type, which Summarize then routes by, and the boost's content. If the boost is gone, is missing its recording or booster, or names a different recording, the event is blocked as read_failed (retained, as for any read that doesn't answer). A booster other than the trusted performer is discarded as untrusted_author.
  • What's handed off. requester_id is the booster, role is the booster's role, and requester_name is the booster's name. acknowledge is false: a boost is a reply, not a request. owner is false. content is the boost itself; recording is the agent's post it answers.
  • Where it's answered. Where the boosted recording lives. A boost on the agent's comment replies in that comment's thread and joins its conversation key (recording:<parent>). A boost on a chat line goes to its Campfire. Anything else replies on the recording itself.
  • Docs. The step-25 comments now say boosted is built and queued is still pending. skills/basecamp-connect/SKILL.md lists boosted among the triggers. For boosted it skips the acknowledgement and the card move, defaults to silence, and says a boost is never an operator's go.

RequiresServed: true

A boost in a project connect.json doesn't serve is discarded at the gate, before any read, rather than blocked as no_route. Only mentioned and assigned are blocked in an unserved project, and they get a holding reply ("this project isn't served yet"). That reply exists because someone asked the agent for something and is waiting. A boost asks for nothing, so a holding reply to a thumbs-up would answer nobody. subscribed and completed, the other non-request triggers, use true for the same reason. It also keeps boosts in unserved projects from spending two reads each.

Deliberately not done

  • queued and edited. The rest of step 25 and step 28 are out of scope.
  • Boosts on a recording's events (e.g. a boost on a completion in a to-do's history). details.boosted_event_id is non-null for these. Basecamp addresses such a boost to whoever performed the event, not to the recording's author, so the creator check would be wrong for it. Telling whether the agent performed that event would take an events read this rule doesn't make. These are discarded as not_addressed, from the details alone, at no read cost.
  • published_by vs. creator. bc3's boostee for a recording is published_by || edited_by. The summary carries creator, and the two differ only for a draft someone else published. A message the agent drafted but someone else published would be admitted although Basecamp addressed the boost to the publisher. One the agent published from someone else's draft would be missed. None of the agent's comments or lines are drafts.
  • Owner. A boost from the owner is not owner. Whether an operator's boost on an agent's explicit ask should count as the go is a separate policy question; the skill says it doesn't.

What can now reach the agent that couldn't before

A boost on a recording the agent created, in a served, in-scope project, given by a person the trust settings already let mention the agent. The recording must not be drafted or trashed, and the boost must not be delegated. That's the whole set, and each case is intended. Cost: each such boost takes one boost read plus one summary read. For a chat line, the summary read includes the SDK's Campfire discovery. In project trust mode this applies to every member's boost on anything in a served project, not just the agent's posts, because the creator is only known after the summary read.

Tests

  • internal/connector/admission/boost_test.go covers:
    • admission on the agent's comment: trigger, requester, role, owner, content = boost, reply, conversation key, and the summary ref routed by recording type
    • chat line and message reply shapes
    • a boost on someone else's recording is not admitted
    • untrusted, allowlisted and project-member boosters
    • agent, delegated and allowed-agent boosts are discarded with zero reads
    • unserved project, event boost and bad details settle with zero reads
    • boost read failures
    • a trashed post is stale
  • TestABoostOnTheAgentsCommentIsHandedOffAsAReply runs end to end: details survive the ledger, then admission, then the request line.
  • An SDK test checks that NewSDKReads().Boosts reads /boosts/:id and returns the recording type.
  • Mutation-checked: dropping the creator check, the booster check, RequiresServed or the event-boost discard each fails a test.
  • bin/ci passes on Linux. Locally on macOS, lint flags internal/connector/driver/proctime_darwin.go, a darwin-only file this PR doesn't touch.

Summary by cubic

Lets basecamp connect hear when someone boosts a comment, Campfire line, or post the agent wrote. boost.created was previously rejected as not_in_matrix, so boosts sat unanswered even though Basecamp addresses them to the recording's author.

Adds a boosted trigger that admits a boost only when it lands on the recording itself and the recording's creator is the agent. The booster is trusted like a mention's performer in every trust mode; an agent's own, delegated, and --allow-agent boosts stay discarded. Since boost.created names no recording type, admission reads the boost first (GET /boosts/:id), which supplies the type the summary read routes on and the boost's content, handed off as the request. The reply goes where the boosted recording lives: a comment's thread, a line's Campfire, or the recording itself. acknowledge and owner are false, and the rule requires a served project so boosts in unserved projects are discarded rather than held (a holding reply to a thumbs-up answers nobody).

Details that lack a boost id, or whose boosted_event_id key is absent, are an invalid pointer and discarded before any read; only an explicit null is read as a boost on the recording. A boost on one of a recording's events is discarded as not_addressed: Basecamp addresses that to the event's performer, not the recording's author. An Agent booster is refused as agent_authored at the boost read — the poll lane carries no actor type, so an allowlisted Agent passes the gate, and the read is where its type shows.

Out of scope

  • queued (rest of step 25) and edited (step 28) triggers.
  • published_by vs. creator mismatches, and whether an operator's boost on an explicit ask counts as a go.