telegram-bridge — HANDOFF.md
# HANDOFF — telegram-bridge
Updated: 2026-07-15 (SHIPPED — deployed and round-trip verified)
## What this is
Pipeline project #1: a dumb pipe between the owner's Telegram (@tunstudio_bot,
chat id in `~/studio/.env`) and `~/studio/bridge/`. Law 13: it moves text, thinks
nothing — no model calls, no shell, no writes outside `bridge/`.
## Current state
- STAGE: BUILD. `bridge_daemon.py` (python3 stdlib only) implements: getUpdates
long-poll → `bridge/inbox/<utc-iso>.md`, chat-id filter, `bridge/outbox/*.md` →
sendMessage → `outbox/sent/`, 1 msg/3s rate limit, >4000-char truncation,
offset persistence, `bridge/last-ping` heartbeat touch.
- `test_bridge_daemon.py`: 5 unit tests against a mock API, gate-verified
(verify.sh python lane runs them; PASS 2026-07-15).
- `studio-bridge.service` installed at /etc/systemd/system/, enabled and active
(owner-side deploy 2026-07-15 — Builder sandboxes cannot systemctl; deployment is
owner/harness work, per standoff RESOLVED line in studio logs/standoff.log).
- Live round-trip PASSED 2026-07-15: outbox file → owner Telegram → owner reply →
bridge/inbox/ in ~25 s, after a service restart. last-ping cycles every ~25 s.
- STAGE: SHIPPED. bridge-alive goal un-suspended and HOLDS.
## How to run & test
```
python3 -m unittest discover -p 'test_*.py' # unit tests
python3 bridge_daemon.py # daemon (reads ~/studio/.env)
```
## Done when (from SPEC.md)
Round-trip outbox→Telegram→reply→inbox within 60 s; `systemctl is-enabled
studio-bridge`; last-ping fresh after 10 min idle; token never in git-tracked
files; verify.sh exit 0.