The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
A Thread Reply Alerts Unless That Very Thread Is Open Implementation Plan
How this is worked: by the project's instructions, task by task, each failing test committed before its code.
Goal: A PM or Buddy reply inside a thread beeps and stays unread on the round dial while its chat is open on the desktop or on the dial's face, unless that very thread is open there. A message in the main stream behaves as today.
Architecture: The dial's alert is a LeadNotice that SwarmCards.raise (cli/src/superTabs/cards.ts) makes from the
newest agent message, thread replies included. It gains an optional thread: the root of the thread the message replies
in, unset for a main-stream message, a thread's root, or a reply also sent to the chat. The cable session's pushNotice
(cli/src/cable/cableSession.ts) today counts a notice as read on the desktop whenever the window has its chat open; it
then also needs the window's threadRoot to be the notice's thread, both when the notice arrives (not sent) and later
(supertab.notice.read). A swarmThread dial gets thread on supertab.notice; the firmware (cable_client.c,
ui_habitat.c ui_supertab_notice) reads a thread notice at once only when the Lead's face shows that thread
(thread_root), otherwise it beeps and stays unread. A dial without swarmThread gets today's frame. The held-notice
inChat WeakSet in cards.ts says the same as thread === undefined, so it is replaced by the field.
Tech Stack: TypeScript (Vitest) for the CLI and cable; C11 with the Python-driven host tests for the firmware
(devices/harness-device/firmware/test).
Spec: Task #2463 (Diego, reported 10-29; replaces closed PR #2222; builds on the thread face #2718/#2756 and tasks in threads #2704). Not done here: the brief's optional "tapping it enters that thread on the face".
Global Constraints
- The PR body starts with:
Requested by [email protected] through Harness. - Swarm code stays out of cli/src/core: the only core change is the generic optional
threadonLeadNotice(cli/src/core/api.ts). - Never publish firmware, run upload scripts or touch the device update manifest; the real-dial check is Diego's after merge.
- Compatibility:
threadis optional everywhere. A dial without swarmThread gets the exact frame of today; old firmware ignores an unknown key; a notice withoutthreadkeeps today's rule on desktop and dial. - Desktop tests use a memory store and a fake sign-in; nothing signs the Mac out of the real CLI.
- Backend changes: none (no backend file changes), so the full Super Tab integration suite is not required; the CLI
coverage gate
npm run test:corecovers the touched core type.
Design
- growth: N/A because the notice stays one held entry per Lead (and one Buddy entry), replaced by the next; nothing new is stored.
- concurrency: N/A because the notices are held in one process's memory and pushed on the session's one queue, as today.
- read cost: no new read; the thread is a field of the message rows
raisealready has. - scale: N/A because one more short id on a frame; the frame is still cut to the dial's limit by
fitText. - compatibility: optional field; the frame key is sent only to a swarmThread dial (see Global Constraints).
- migration + rollback: N/A because nothing persists; rolling back restores today's behavior.
- audience: unchanged; the notice is built from messages the reader can already read.
- identity: unchanged.
- failure: a notice whose thread is unknown on the dial beeps (the safe side), never silently reads.
- platforms: CLI daemon on macOS, Linux and Windows; firmware on the round dial.
Review Focus
- A reply also sent to the chat, and a thread's root, are main-stream notices (Task 1 tests).
- The desktop with the chat open but another thread, or no thread, open: a thread notice is sent and not read; opening
that thread sends
notice.readonce (Task 2 tests). - An older dial (no swarmThread) gets
supertab.noticewithoutthread, byte for byte as today (Task 2 test). - The face showing the main chat beeps for a thread notice; the face in that thread reads it at once; a main-stream notice keeps today's rule (Task 3 tests).
- The recap answered from a held notice (
held) still never takes a thread reply for the chat's recap, now throughnotice.thread(existing test "never answers the chat recap from a notice that is a thread reply").
Task 1: The notice names its thread
Files:
- Modify:
cli/src/core/api.ts(LeadNotice),cli/src/superTabs/cards.ts(lastAgentMessage,raise,held) - Test:
cli/src/superTabs/cards.spec.ts
Interfaces:
Produces:
LeadNotice.thread?: string, the root of the thread the message replies in; absent for a main-stream message.lastAgentMessagereturns the message'sthreadwhen it is a reply only in a thread.Step 1: Write the failing tests in
cards.spec.ts,describe('SwarmCards notices'):a PM reply inside a thread is a thread notice— a new PM line withthread: 'x1'in the Buddy chat: the notice is{ chat: 'pm', chatId: 'pm-web', id: 'x2', ..., thread: 'x1' }.a thread reply also sent to the chat, or a thread's root, is no thread notice—alsoInChat: true, and a root (threadequal to its own id): the notice has nothread.
Step 2: Run
npx vitest run src/superTabs/cards.spec.tsincli: the first FAILS (nothread).Step 3: Commit the failing tests and push.
Step 4: Implement:
thread?: stringonLeadNotice;lastAgentMessagereturnsthreadfor a row whosethreadis a string other than its id and notalsoInChat;raisecopies it;heldusesnotice.thread === undefinedand theinChatWeakSet goes.Step 5: Run the file and
npx tsc --noEmit -p .: PASS.Step 6: Commit and push.
Task 2: The desktop reads a thread notice only in that thread; the frame carries it
Files:
- Modify:
cli/src/cable/cableSession.ts(noticeFrame,pushNotices,pushNotice) - Test:
cli/src/cable/cableSession.spec.ts
Interfaces:
Consumes:
LeadNotice.thread(Task 1);activeSwarmProject().threadRoot.Produces:
supertab.noticewiththreadfor a swarmThread dial.Step 1: Write the failing tests in
cableSession.spec.ts,describe('swarmThread'):a thread notice is sent while its chat is open, and read only when the window opens that thread— the window onpm1with no thread, then threadother: the notice is sent withthread: 'r1'and nonotice.read; the window opensr1: onenotice.read.a thread notice arriving while that thread is open is not sent— noted as read.a dial without swarmThread gets today's frame for a thread notice—supertab.noticewith nothreadkey.
Step 2: Run
npx vitest run src/cable/cableSession.spec.ts -t swarmThreadincli: they FAIL.Step 3: Commit the failing tests and push.
Step 4: Implement:
pushNoticespasses the window's open conversation and thread root;pushNoticecounts a notice as open on the desktop when the chat matches and, for a thread notice, the root matches;noticeFrameaddsthreadwhen the session speaks swarmThread.Step 5: Run the file and
npx tsc --noEmit -p .: PASS.Step 6: Commit and push.
Task 3: The face beeps for a thread reply unless it shows that thread
Files:
- Modify:
devices/harness-device/firmware/main/cable_client.c(handle_supertab_notice),devices/harness-device/firmware/main/ui/ui_screens.h,devices/harness-device/firmware/main/ui/habitat/ui_habitat.c(ui_supertab_notice) - Test:
devices/harness-device/firmware/test/test_touch_ui.py,devices/harness-device/firmware/test/test_cable_supertab.py
Interfaces:
Produces:
ui_supertab_notice(tab, lead, chat, chat_id, thread, text, at);threadis "" for a main-stream notice.Step 1: Write the failing tests:
test_touch_ui.py, in the thread face checks: a PM thread notice form9while T0's face shows the main PM chat beeps and stays unread; while the face shows threadm9it is read at once and does not beep; one for another thread while the face showsm9beeps.test_cable_supertab.py:supertab.noticewiththreadreaches the UI with it; without it, "".
Step 2: Run
python3 test/test_touch_ui.pyandpython3 test/test_cable_supertab.pyin the firmware folder: FAIL.Step 3: Commit the failing tests and push.
Step 4: Implement:
handle_supertab_noticereadsthread("" when absent; a root too long to hold is passed as it is, so no face matches it and it beeps, as Design's failure line says);ui_supertab_noticetakes it; the face reads a notice at once only when it shows that chat and, for a thread notice, that thread. The Buddy's quiet word keeps its rule.Step 5: Run both files and
test/run.sh: PASS.Step 6: Commit and push.
Task 4: Evidence
- Red/green evidence (each failing run before its code, then green) in a PR comment.
-
npm run test:coreincli(the touched core type), the cards and cable spec files,npm run typecheck, firmwaretest/run.sh. - Mark the PR ready; add the review step.