tmux-amq/workplans/TAMQ-WP-0015-reliable-trigger-and-worker-blocks.md
repo-manager e4868afd92
Some checks failed
tamq-ci / test (push) Failing after 6s
chore(registrar): assign State Hub identifiers
Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a03397-4d51-7fd1-8ff2-946eb22ea2bc
2026-08-25 23:23:20 +02:00

111 lines
3.8 KiB
Markdown

---
id: TAMQ-WP-0015
type: workplan
title: "Reliable trigger delivery and worker message blocks"
domain: communication
repo: tmux-amq
status: finished
owner: codex
topic_slug: reliable-trigger-worker-blocks
created: "2026-08-25"
updated: "2026-08-25"
state_hub_workstream_id: "841ea8dc-8f58-5c41-9eba-ecc8817ad375"
---
# Reliable trigger delivery and worker message blocks
Correct first-delivery and trigger behavior for interactive terminal programs,
allow agents to emit practical multi-line message blocks, and give repository
workers a concise introduction that matches the implemented protocol.
## Diagnose first delivery and trigger submission
```task
id: TAMQ-WP-0015-T01
status: done
priority: high
state_hub_task_id: "37880822-68a6-5e76-a1da-65ecc7b8ecc3"
```
Compare durable live history with the terminal delivery path. Distinguish queue
admission, tmux placement, terminal paste detection, and agent acknowledgement.
### Evidence
- Live history showed the reported trigger message reached durable state
`injected` within roughly 40 ms but did not start an agent turn.
- Trigger previously sent literal text and Enter in one immediate tmux command
list, matching the receiving TUI's paste/newline behavior.
- Endpoint registration occurred as soon as the PTY proxy was ready, without a
foreground-program initialization grace.
## Make trigger distinct and protect first delivery
```task
id: TAMQ-WP-0015-T02
status: done
priority: high
state_hub_task_id: "a7b1dea8-b0d2-5cec-abc2-7f6d13cf0215"
```
Delay the one trigger Enter beyond terminal paste detection and defer input-mode
delivery briefly after endpoint registration. Retain pushy's no-Enter contract.
### Evidence
- Trigger now places text, waits 150 ms in the checked tmux command queue, and
sends exactly one Enter; pushy still performs literal placement only.
- Pushy and trigger wait a configurable one-second endpoint startup grace.
- A real tmux paste-sensitive fixture classifies immediate Enter as a newline
and the new trigger sequence as one submission.
## Collect worker output through an empty line
```task
id: TAMQ-WP-0015-T03
status: done
priority: high
state_hub_task_id: "2bbc410d-2373-571e-9625-a06d7e0c5a05"
```
Treat a worker `To:repo:` row as the beginning of a block. Append subsequent
non-empty worker rows and admit one durable message at an empty row, a new
address, or process exit.
### Evidence
- PTY normalization emits empty CRLF rows and infers visual empty rows from
forward cursor gaps in full-screen interfaces.
- Continuation presentation indentation is removed and durable bodies retain
newline boundaries.
- Delivery repeats the non-routable `From:` envelope on every physical line,
preventing a continuation from feeding back into routing.
- A real tmux/PTY test routes a cursor-positioned, bullet-framed worker block
with a continuation and correct `worker_output` provenance.
## Align introductory documentation and verification
```task
id: TAMQ-WP-0015-T04
status: done
priority: medium
state_hub_task_id: "38773ea9-044e-5968-b44a-004680553df6"
```
Review the introduction produced during the audit-core/flex-auth conversation,
make a concise canonical copy in this repository, and align README/SCOPE/CLI
behavior with the revised protocol.
### Evidence
- `TamqMessagingIntroduction.md` now leads with the protocol, blank-line rule,
delivery modes, provenance, agent behavior, and state-based troubleshooting.
- The reviewed document is mirrored to the original untracked audit-core path.
- Direct `tamq send` now shares case-insensitive `To:` parsing with managed
terminals.
- `make check` passes 166 tests, including real tmux and PTY coverage.
## Residuals
Bounded retry and positive acknowledgement semantics remain owned by
`TAMQ-WP-0003`; this work does not claim that `injected` means agent-processed.