Tasks: channels — back-and-forth user communication, starting with a Slack bot
The last spec artifact. A DAG derived from the design and testing plan.
Task list
[x] 1. Write the failing unit tests (
test_channels.py)- Config parsing (absent/malformed → no channels, defaults match schema); event filtering; verbosity rendering; binding/cursor state (cap, atomicity, restart); Slack channel against a fake client (call-time token, thread reuse, missing token/channel fail closed); inbound steps (map, own-drop, allow-list, mirror compose with scrub + defang, cursor advance).
- Depends on: none
- Requirements: R1.4, R2.1–2.2, R3.1–3.3, R4.5–4.6, R5.1, R5.3, R6.1
- Test:
T1,T8(red)
[x] 2. Write the failing integration scenarios (
test_channels_integration.py)- Gherkin-documented,
Requirement:links: ask → work-item first + broadcast + binding; thread reply → mirror (marker) → delivery (comment=False); socket event through the same pipeline; watcher on interval, stops with daemon; no-session reply still mirrored; empty-allow-list denial. - Depends on: none
- Requirements: R1.1–1.3, R2.3, R4.1–4.4, R5.2, R5.4, R6.2
- Test:
T2,T8(red)
- Gherkin-documented,
[x] 3. Capture the red run as evidence
- Depends on: 1, 2
- Requirements: (process —
tdd.mode: standard) - Test:
evidence/red.md
[x] 4.
channels/base.py+channels/state.py— contract, rendering, bindingsOutboundEvent,Channelprotocol,ChannelError, verbosity renderer,load_channels; the JSON state store (threads, cursors, cap, atomic replace).- Depends on: 3
- Requirements: R1.1, R1.4, R2.1–2.2, R6.1
- Test:
T1(green)
[x] 5.
channels/slack.py— the Slack bot provider, both transportsSlackBotChannel(injectable client factory, call-time env token,chat.postMessagethreading,conversations.repliesfetch); the Socket Mode listener feeding the same handler.- Depends on: 4
- Requirements: R3.1–3.3, R4.2, R4.4–4.5
- Test:
T1,T2 -k socket(green)
[x] 6.
channels/broadcast.py+ theask_sessionseam- Best-effort fan-out with
channel.posted/channel.post_failed;ask_sessionbroadcasts after its work-item post, outcome-neutral. - Depends on: 4, 5
- Requirements: R1.2, R2.3
- Test:
T2 -k asked(green)
- Best-effort fan-out with
[x] 7.
channels/inbound.py— map → own-drop → authorize → mirror → deliver- The pipeline with its event emissions; mirror via
comments.post_issue_comment(mark_self_authored, scrub, defang); delivery viacore_sessions.reply_session(..., comment=False). - Depends on: 5
- Requirements: R1.3, R4.6, R5.1–5.4
- Test:
T1,T2,T8(green)
- The pipeline with its event emissions; mirror via
[x] 8.
channels/watcher.pywiring + the two daemon run-loopsstart_watcher(cli_config, stop_event)beside the self-diagnosis watcher inpoller/daemon.pyandwebhook/daemon.py;Nonewhen disabled orread.modeis notpoll.- Depends on: 7
- Requirements: R4.1, R4.3
- Test:
T2 -k watcher(green)
[x] 9. The
channelsCLI verb (commands/channels_cmd.py)status(token presence only),poll(one cycle),listen(Socket Mode foreground); registered incommands/__init__.py; exit codes 0/1/2.- Depends on: 7, 8
- Requirements: R4.1–4.2, R6.2 (status shows no secrets)
- Test:
T1 -k status,T8 -k token(green)
[x] 10. Config schema + instances + event types
channelssection in.the-loop/cli-config.schema.json, byte-copied tocli/the_loop/schemas/; commented block in.the-loop/cli-config.yamland the shipped template; sixchannel.*types inEVENT_TYPES.- Depends on: 4
- Requirements: R6.1–6.2
- Test:
T12(parity gates green)
[x] 11. Documentation
docs/config/cli/channels-options.md(every leaf, Type/Default); rows indocs/config/cli/index.mdanddocs/config/index.md;docs/cli/commands/channels.mdplus its commands index row;docs/cli/state.md(bindings file); VitePress sidebars;reference/observability.mdevent catalog;reference/collaboration.md§ channels; capability docdocs/capabilities/channels.md+ index +docs/capabilities/observability.mdhistory;decision-094; README channels mention.- Depends on: 9, 10
- Requirements: (gates: capability-docs, documentation)
- Test:
T12(docs parity P1–P5 green)
[x] 12. Verification — execute the plan, record results and evidence
- Run T1, T2, T8, T12, T13; complete the plan's Verification results; commit evidence.
- Depends on: 6, 7, 8, 9, 10, 11
- Requirements: all
- Test: the plan itself
DAG
flowchart LR
1["1 unit tests (red)"] --> 3["3 red evidence"]
2["2 integration tests (red)"] --> 3
3 --> 4["4 base + state"]
4 --> 5["5 slack provider"]
4 --> 10["10 schema + events"]
5 --> 6["6 broadcast + ask"]
5 --> 7["7 inbound pipeline"]
7 --> 8["8 watcher + daemons"]
7 --> 9["9 CLI verb"]
8 --> 9
9 --> 11["11 docs"]
10 --> 11
6 --> 12["12 verification"]
7 --> 12
8 --> 12
9 --> 12
10 --> 12
11 --> 12