Files
tai/taicpp
retoorandClaude Opus 4.8 79ae6f27da cpp-safety: safe-C++ playbook, fix a second UB, and a sanitizer net
Response to incident WA-2026-10-27 (the std::vector max_size() crash). Deep
research archived under research/safe-cpp-practices (8 Tier 1, 37 Tier 2, 2
conclusions) on production-safe C++ that keeps development speed: OpenSSF
compiler hardening, the C++ Core Guidelines bounds profile, integer-overflow
practice, libFuzzer/sanitizer CI, the sanitizer overhead ladder, clang-tidy
ratchets.

The research prescribed an ASan+UBSan+_GLIBCXX_ASSERTIONS build of the parsers.
Standing it up immediately caught a second, independent undefined-behavior bug
that two manual reviews had missed: a protobuf varint loop that shifted by up
to 70 bits (shift >= 64 is UB) on malformed input. Fixed and guarded by a
deterministic test and the sanitizer net.

- src/whatsapp/wa_proto.cpp: guard the wire-0 varint shift (the UB).
- tests/whatsapp_test.cpp: add an overlong-varint hostile case.
- tools/san-whatsapp.sh: the standing sanitizer net for detz::wa parsers.
- WaClient frame capture: a frame that fails to decode/dispatch has its exact
  bytes recorded to <home>/whatsapp/last-error.log (bounded), so the still
  unreproduced live <iq> failure becomes a one-paste deterministic fix. Wired
  from the wizard and the whatsapp_send tool.
- docs/cpp-safety.md: the project-wide playbook and design decisions (four
  layers: overflow-safe checked-reader parsing, cheap release hardening, the
  sanitizer test net, capture). docs/whatsapp.md section 13.6 records the
  follow-up and the honest open item. AGENTS.md makes it a standing rule;
  cap.md and mcp.md inherit it for their wire parsers.

Verified: build, whatsapp_test (incl. hostile+fuzz), make lint, and
tools/san-whatsapp.sh all green; research audit PASS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-27 19:03:32 +01:00
..
2026-10-24 06:40:09 +02:00
2026-10-24 07:27:06 +02:00
2026-10-24 06:43:45 +02:00
2026-10-25 19:25:54 +01:00

detz: C++23 port of tai.py

Future molo detz subcommand. See plan.md, SPEC.md, docs/. Build: make && make test. Binary: build/detz. Rules for working here: AGENTS.md.

What taicpp adds on top of the port

The port is behavior-compatible with ../tai.py and checked against it (PARITY.md, docs/parity.md). These parts exist only here; each has a specification and tests:

Feature Spec Code Tests
Fuzzy matching of identifiers (letter order, word boundaries, typos, trigrams) docs/fuzzy.md src/util/fuzzy.* build/fuzzy_test
CAP agents and their models: discovery, probes, @agent, @agent:model, @model docs/cap-agents.md src/cap/cap_model_catalog.*, src/cap/cap_mention.* build/capmcp/cap_model_catalog_test
Sub agents in live panels on the multiplexer screen, with supervision docs/orchestration.md src/orch/, src/mplex/mplex_vpane.* build/orch_test, tests/orch_mplex_e2e.py

Reading order for a new contributor: docs/cap.md (the protocol), docs/cap-agents.md (agents and models), docs/fuzzy.md (how a mention is matched), docs/mplex.md and docs/orchestration.md (the screen).

Using it

@claude refactor the parser           run one turn on a CAP agent (typos are fine: @clde)
@claude:opus review the diff          on a specific model of that agent
@opus review the diff                 a model name alone works when one agent offers it
@claude                               pin the agent for following messages;  @auto clears all pins

Sub agents (fork workers and agent turns) appear in panels on the right of the multiplexer screen while they work; closing a panel cancels its agent. TAI_ORCH_PANELS=0 turns the panels off.

Tests

make test builds every test binary and runs tests/run_all.py (36 steps, logs in build/test-logs/). Single steps: python3 tests/run_all.py --only orch, --only mplex, --only capmcp, --only fuzzy. The research behind the decisions is in ../research/ (index: ../research/INDEX.md).