Skip to content

Design + PoC: event-driven Slack collector (Socket Mode) to replace archer-slack-review polling #2137

Open

Description

@dezren39

archer-slack-review polls a watermark every 15 min (~100K input/run × ~96 runs/day ≈ 9.6M/day) and usually finds nothing. Replace the polling with an event-driven collector (Drew approved 2026-10-29):

  • A small service using Slack Socket Mode (outbound WebSocket — no public endpoint needed; Cloudflare Worker + Events API is the off-box alternative) appends messages, replies, and reactions from the watched channels to a local store.
  • The review job wakes ONLY when the store has new items (hook/signal), reads just the delta, and acts.
  • Placement per the flake rule (developing-today/code flake if on the laptop; sandbox systemd if on the sandbox). The service is deterministic — no LLM in the collection path.

PoC scope: the #alignment channel end-to-end (collect → store → wake → review). Success: quiet-day agent cost ~0; no missed Aster replies over a 3-day parallel run against the existing poller. Afterwards, generalize the pattern to other watermark polls.

Activity

  1. developing-today commented on Oct 29, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    TOP PRIORITY (Drew, 2026-10-29 01:23 CDT): Batch 3 fleet consolidation — pick this up in the next runs, ahead of routine work. Being enqueued to repo-health-code-pilot at top priority now.

  3. added
    queue/queuedHas a queued task in the Supabase agent queue
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 29, 2026
  4. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  5. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

    Premise — verified against live state

    • archer-slack-review is enabled and running on a 15-minute interval (checked live: last run 2026-10-29 01:39 CDT, succeeded; next 01:53) — ~96 agent runs/day.
    • Token check-in Bump build/buck/preludes/buck2-prelude from 3a02ea3 to 370cd4d #5 (2026-10-28 23:56 CDT) measured its per-run floor at ~100K input/run, so ≈ 9.6M input/day, and the channel is quiet most of the day — the "usually finds nothing" claim holds.
    • The mechanism it uses is a watermark pull (puller.py + state DB) — collection and the LLM review are currently the same run, which is exactly the coupling this issue removes.

    Design / decisions

    1. Placement: the sandbox, as a systemd user service. Both the puller store (~/workspace/archer-slack/puller/state/archer-slack.db) and the review job live on the sandbox; the collector is an outbound WebSocket (no public endpoint, no laptop flake involvement). Per this issue's placement rule: sandbox systemd.
    2. No Slack app changes expected for the PoC. The Archer app manifest already has socket_mode_enabled: true and the needed bot events (message.channels/groups/im/mpim, app_mention), and the app-level token already exists in Bitwarden Secrets Manager as slack.archer-app-token (name verified; value not read). If connections:write turns out to be missing, the implementer stops and names the exact app change for Drew rather than widening scopes silently.
    3. Collector shape: a small deterministic Python service beside the puller. It appends messages, thread replies and reactions for the watched channel to the local store, deduplicated by (channel, ts) — so overlap with the watermark puller is safe and the puller remains the backfill safety net for any collector downtime. No LLM in the collection path.
    4. PoC = parallel run, no cadence change. For 3 days the collector runs alongside the untouched 15-min poller; fidelity is compared against the puller's history (zero missed messages; Aster replies checked explicitly — that is the channel's reason to exist). Quiet-day agent cost only reaches ~0 at cutover (signal-triggered review replacing the poll), and cutover is a separate decision gated on the parallel-run report — cadence changes stay Drew-approved, so the PoC itself changes no schedule.
    5. Wake mechanism at cutover (for the report to confirm): the review job fires from the store's new-item signal rather than the clock; the design in ~/workspace/archer-slack/slack-agent-design.md already sketches Socket Mode as the Phase-2 escape hatch from polling, and this implements it.

    Implementation routed: queue task 3176 (priority 10, per Drew's top-priority direction for Batch 3) carries the build + 3-day parallel run + report-back on this issue. Epic #2055 updated with this outcome.

    Labels updated to mirror the queued follow-up.

  6. added
    queue/queuedHas a queued task in the Supabase agent queue
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 29, 2026
  7. 10 remaining items

  8. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 1, 2026
  9. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up (resume after 3-day window)

    • Agent: repo worker (repo-worker-code, OpenChamber scheduled lane)
    • Session / ID: queue task 3176
    • Found via: atomic queue re-claim at the recorded parallel-run end
    • Task: Revalidate the #alignment collector fidelity window and report only from fresh data.
    • Environment check: This lane is on the laptop; ~/workspace/archer-slack is absent locally and archer-slack-collector.service is inactive here. The required collector and SQLite store are specified as sandbox-resident, so no fidelity result is available locally.
    • Next: block pending sandbox-side aggregate comparison (including Aster replies and service uptime); do not modify or stop the collector.
  10. added
    queue/blockedQueue or user escalation state
    status/blockedQueue or user escalation state
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 1, 2026
  11. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · blocked (execution-host access)

    • Agent: repo worker (repo-worker-code, OpenChamber scheduled lane)
    • Session / ID: queue task 3176
    • Blocker: The required sandbox workspace/database and collector service are absent/inactive on this laptop, and this lane is restricted to laptop-local work. I did not inspect or modify the service or its data.
    • Required to resume: Run an aggregate collected_events vs puller-history comparison for #alignment over the 3-day window (explicitly check Aster replies) and report service uptime/restarts from the sandbox; then attach/post the evidence here. No fidelity or cutover conclusion until then.
  12. added
    queue/queuedHas a queued task in the Supabase agent queue
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 3, 2026
  13. developing-today commented on Nov 3, 2026

    @developing-today
    Contributor

    agent-note:v1
    state: reviewed (coverage loop-back)
    Coverage pass 2026-11-03, loop-back review: this issue was re-reviewed (drift / overlap / already-handled / stale / blockers / ordering) so every open issue in the four repos is reviewed and in the system. Verdict: still live; in the system as task 3176 (small_fix, blocked, priority 10) in repo-health-code-pilot. Labels audited and synced. If it is already handled at current main, its triage closes it with evidence; if oversized, the triage files the split; blockers belong on this issue.
    Found via: coverage loop-back 2026-11-03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority/highImportant and time-sensitivequeue/blockedQueue or user escalation statequeue/queuedHas a queued task in the Supabase agent queuesource/creatorFiled by the new-issue-creator jobstatus/blockedQueue or user escalation statetask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions