Skip to content

feat(syntropy): SYN-206 Task 1 β€” formatProfileBlock (WhatsApp health-profile context) - #24

Merged
supmo668 merged 2 commits into
mainfrom
mangyinm/syn-206-whatsapp-profile-injection
Jun 18, 2026
Merged

supmo668 merged 2 commits into
mainfrom
mangyinm/syn-206-whatsapp-profile-injection

Conversation

@supmo668

@supmo668 supmo668 commented Jun 18, 2026 •

Copy link
Copy Markdown

What

Pure formatProfileBlock(raw): string | null β€” turns get_health_profile data into a bounded, labelled [SYNTROPY_PROFILE] block for the WhatsApp agent's context. Allergies/conditions first; failure-safe (never throws β†’ null on anything unusable); prompt-injection-sanitised (strips line-breaking code points + defangs block markers BEFORE the length cap; linear-time, no ReDoS) per SYN-170 / OWASP LLM01. No wiring yet (Task 2).

Governance (CTO-verified)

  • Code-review strong PASS (security-sensitive logic; correct never-throw + injection hygiene + safety-critical field order).
  • Sealed-referee TDD 27/27 (RED-validated); QGR sealed-suite receipt 713fb57 (submodule-bound, diff_base=origin/main) VERIFIED by CTO from the submodule cwd.
  • Rebased onto current openclaw main (7d138d0); diff = exactly the 8 SYN-206 files.

NOTE: receipt was re-minted submodule-bound (interim for plugin findings #5/#6 β€” sealed/QGR gate binds parent-level by default; durable per-module/cwd fix to follow). Authored by openclaw, landed by CTO. Linear SYN-206.

Summary by CodeRabbit

  • New Features

    • Added a health profile formatter with built-in security protections against prompt injection attacks.
    • Introduced a sealed test suite infrastructure for test-driven development challenges.
  • Documentation

    • Published comprehensive TDD contract specifications and test manifest for profile formatting behavior.
  • Tests

    • Added extensive test coverage for profile normalization, boundary conditions, and robustness across edge cases.

Matthew M.Y. Mo and others added 2 commits June 17, 2026 17:59
- vitest.sealed.config.ts: dedicated project for the sealed challenge suite
  only (non-invasive; existing configs glob src/, extensions/, test/ singular)
- scripts/run-sealed-referee.mjs: drives the vitest JSON reporter into coarse
  RESULT pass|fail <category> lines for tools/referee (reporter-API robust)
- challenge-suite root scaffolded (test-author writes there; the seal hook
  blocks implementer reads)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…N-206 task 1)

Pure formatter turning get_health_profile data into a bounded, labelled
[SYNTROPY_PROFILE] block for before_agent_start injection. Allergies/conditions
first; failure-safe (null on envelope/empty/malformed); never throws.

Built under sealed-referee TDD (27 sealed cases green). Quality gate hardened
two reviewer-found gaps the sealed suite missed:
- prompt-injection hygiene (SYN-170/LLM01): sanitise newlines + defang block
  markers in every user-controlled value so it cannot forge structure
- never-throw: top-level guard + per-value String() guard for hostile
  getters/toString

Adds visible bug-exposing tests (profile.test.ts) and the interface contract.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@linear-code

linear-code Bot commented Jun 18, 2026

Copy link
Copy Markdown

SYN-206

@supmo668
supmo668 merged commit c530214 into main Jun 18, 2026
@supmo668
supmo668 deleted the mangyinm/syn-206-whatsapp-profile-injection branch June 18, 2026 01:04
@coderabbitai

coderabbitai Bot commented Jun 18, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f5c2908b-3fd3-4788-94e4-17aebc805c9b

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 7d138d0 and 76d01bf.

πŸ“’ Files selected for processing (8)
  • extensions/syntropy/docs/SYN-206-formatProfileBlock.contract.md
  • extensions/syntropy/src/profile.test.ts
  • extensions/syntropy/src/profile.ts
  • scripts/run-sealed-referee.mjs
  • tests/sealed/openclaw/MANIFEST.md
  • tests/sealed/openclaw/README.md
  • tests/sealed/openclaw/profile.sealed.test.ts
  • vitest.sealed.config.ts

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


πŸ“ Walkthrough

Walkthrough

Adds formatProfileBlock(raw: unknown): string | null to extensions/syntropy/src/profile.ts, converting Syntropy health profile data into a sanitized, marker-delimited context block. Accompanies the implementation with a TDD contract spec, local QG tests, a sealed Vitest config, a CLI referee runner script, and a sealed test suite with manifest.

Changes

formatProfileBlock Implementation

Layer / File(s) Summary
TDD contract specification
extensions/syntropy/docs/SYN-206-formatProfileBlock.contract.md
Defines input shapes, null-return conditions, exact output marker format, safety-critical field rendering order, normalization rules for arrays/objects, 200-char truncation cap, and hygiene/security requirements preventing line-break and marker injection.
Core implementation
extensions/syntropy/src/profile.ts
Exports formatProfileBlock with block-marker constants, isPlainObject/isLineBreak predicates, sanitizeValue, normalizeStringArray, normalizeObjectPairs, capValue, and the main formatter wrapped in try/catch to guarantee null on any unexpected error.
QG injection and never-throws tests
extensions/syntropy/src/profile.test.ts
Vitest tests asserting newline/marker injection is defanged, CR/LS chars are stripped, and the formatter returns null (not throws) on failing property getters or object toString() errors.

Sealed Referee Infrastructure

Layer / File(s) Summary
Sealed Vitest config
vitest.sealed.config.ts
New Vitest config extending the base, scoped to tests/sealed/**/*.sealed.test.ts with coverage disabled.
Sealed referee CLI runner
scripts/run-sealed-referee.mjs
Spawns Vitest with JSON reporter output to a temp file, parses results into RESULT pass/fail <category> stdout lines, handles zero-assertion build/load failures, and cleans up the temp directory in a finally block.
Sealed test suite and docs
tests/sealed/openclaw/profile.sealed.test.ts, tests/sealed/openclaw/MANIFEST.md, tests/sealed/openclaw/README.md
Sealed tests covering formatter output, envelope rejection, normalization robustness, 200-char bounds, and safety-critical field ordering; manifest maps describe() categories to contract sections.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

πŸ‡ Hop, hop! A profile block is born,
With markers clean and fields well-worn.
No newlines sneak, no markers hide,
The sealed referee checks inside.
Null for failures, trim the restβ€”
This little rabbit passed the test! ✨

✨ Finishing Touches
πŸ“ Generate docstrings
  • Create stacked PR
  • Commit on current branch
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mangyinm/syn-206-whatsapp-profile-injection

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

⚠️ Formal models conformance drift detected

The formal models extracted constants (generated/*) do not match this openclaw PR.

This check is informational (not blocking merges yet).
See the formal-models-conformance-drift artifact for the diff.

If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant