---
status: resolved
phase: 25.3-project-context-envelope-persistence-encoding-defects
source: [25.3-VERIFICATION.md]
started: 2026-05-22T22:30Z
updated: 2026-05-23T11:00Z
---

## Current Test

[all smokes complete; 4/5 PASS, #5 inline-covered, 1 new defect filed]

## Tests

### 1. Live-todlando artifact materialization smoke

Send a deliberate `<project-context>` commune to the running `todlando` perch and confirm `%LOCALAPPDATA%\spt\psyches\tracked\projects\claude_skill_owl\todlando.md` materializes within seconds with a `<!-- spt:source=direct spt:routed_at=... -->` first line and the marker body content.

expected: Project file appears at the path above with the precedence marker on line 1 and contains the commune body. `[FILE-DROP] route_inbound_commune_body for todlando` log line present in `%LOCALAPPDATA%\spt\logs_latest\todlando.log`. `spt:source=` appears ONLY in `[FILE-DROP]`/`[ROUTE-GUARD]` log entries, NEVER inside `[PSYCHE] resume` payload (cycle-4 HIGH 1 + cycle-5 HIGH 2 marker-invisibility smoke). `live_context.md` byte-0 remains `---\n` so YAML front-matter still parses (cycle-5 HIGH 1 back-compat smoke).

result: pass
verified: 2026-05-23T10:48Z (v1.11.8)
evidence: "projects/claude_skill_owl/todlando.md materialized with header `<!-- spt:source=direct spt:routed_at=2026-05-23T10:48:50Z -->`. Wrapper log shows `[FILE-DROP] route_inbound_commune_body for todlando (commune-inbound; live=Written, project=Written)`. 0 ANSI escape bytes in last 500 wrapper-log lines. Drop file consumed + deleted cleanly via single-writer contract (Plan 25.3-05 D-E-01). Previous `(file gone)` race no longer reproducible."

### 2. Encoding-contract smoke (cycle-5 HIGH 3)

Tail the next `[PSYCHE] resume (exit=0)` block in `%LOCALAPPDATA%\spt\logs_latest\todlando.log` after a deliberate commune. Confirm the LLM-stdin section shows `Inbound commune envelope at <ts>:` natural-language header followed by literal `<live-context>` / `<project-context>` tags (NOT `&lt;...&gt;` entities).

expected: Log shows decoded literal tags (no `&lt;EVENT`, `&lt;/EVENT`, `&lt;project-context`, `&lt;/project-context`, `&lt;live-context`, `&lt;/live-context`, `&lt;br&gt;` substrings inside the prompt body). Header line `Inbound commune envelope at <ts>:` precedes the body. No `<EVENT type=` framing token at the start of the body.

result: pass
verified: 2026-05-23T10:48Z (v1.11.8)
evidence: "[STDIN] block at 03:48:50 shows literal `<live-context>` and `<project-context>` tags in body following `Inbound commune envelope at 2026-05-23 03:48:50 PDT:` natural-language header. No HTML entities. No `<EVENT type=` framing inside body. Encoding contract (Plan 25.3-03) holds end-to-end."

### 3. G HAPPY-PATH route hook smoke (new, Plan 25.3-05)

Trigger a Psyche LLM turn that emits a two-slice envelope into `agents/todlando/live_context.md`. Confirm wrapper post-resume route hook fires immediately (not cadence-driven) and writes the project slice to `projects/claude_skill_owl/todlando.md` with the precedence marker.

expected: Wrapper log shows `[LIVE-CONTEXT-POST-WRITE] route for todlando live=Written project=Written` immediately after `[PSYCHE] resume (exit=0)`. Hook fires at all three call sites (init / resume / final) per Plan 25.3-05 D-E-07. RouteLiveCtxOutcome enum + ReentrancyGuardSentinel prevent recursion.

result: pass
verified: 2026-05-23T10:40Z (v1.11.8)
evidence: "Log line `[03:40:27] [LIVE-CONTEXT-POST-WRITE] route for todlando live=Written project=Written` confirms hook fired and both slices routed. Three POST-WRITE log lines observed across session (one per hook call site). Reentrancy guard later observed correctly in smoke #4."

### 4. G2 self-heal single-respawn smoke (new, Plan 25.3-06)

Deliberately induce a Psyche turn that omits `<project-context>` while the prompt carried CURRENT_PROJECT_CONTEXT and the project is resolvable. Confirm wrapper detects malformed live_context.md, fires single respawn via `resume_session_with_exit` with corrective prompt anchored on `did not honor the two-slice envelope contract`.

expected: Wrapper log shows `[LIVE-CONTEXT-MALFORMED] respawning with corrective prompt self_id=todlando` exactly ONCE. Subsequent `[STDIN]` block contains the corrective-prompt anchor phrase. Reentrancy guard kicks in to prevent route recursion (`[LIVE-CONTEXT-POST-WRITE] skip reentrancy_guard self_id=todlando`).

result: pass
verified: 2026-05-23T10:57Z (v1.11.8)
evidence: "Log line `[03:57:24] [LIVE-CONTEXT-MALFORMED] respawning with corrective prompt self_id=todlando` fired exactly once after Psyche emitted ONLY live-context envelope. Corrective prompt at `[03:57:24] [STDIN] 546 bytes to resume` contains literal anchor `did not honor the two-slice envelope contract`. Reentrancy guard line `[03:57:50] [LIVE-CONTEXT-POST-WRITE] skip reentrancy_guard self_id=todlando` confirms no recursion. Post-respawn route attempt logged."

### 5. G2 negative control / retry_exhausted smoke (new, Plan 25.3-06)

Deliberately induce TWO consecutive malformed Psyche turns. Confirm wrapper fires single respawn on first detection, then logs `[LIVE-CONTEXT-MALFORMED] retry_exhausted` on second detection without further respawn.

expected: First malformed turn → `respawning` log. Respawn produces still-malformed live_context.md → second detection → `retry_exhausted` log line + no further respawn.

result: skipped
reason: "G2 trigger correctly gated out on second induction commune (`[LIVE-CONTEXT-POST-WRITE] skip no-project-slice ... prompt_had_project_ctx=false`) — Plan 25.3-06 rule 3 (prompt must carry CURRENT_PROJECT_CONTEXT) prevented the second G2 fire. This is correct gate behavior, not a failure. Runtime retry_exhausted exercise deferred. Coverage held by 4/4 inline G2 tests at build time (fire / no-fire-on-rule-6 / respawn-routed / retry-exhausted)."
inline_coverage: "tests in src/live/wrapper/mod.rs cover retry_exhausted path; 4 G2 tests green at v1.11.8."

## Summary

total: 5
passed: 4
issues: 0
pending: 0
skipped: 1
blocked: 0

## Gaps

(none — original gaps closed via Plans 25.3-05 + 25.3-06)

## New Defect Surfaced During Smoke (carry to follow-up)

### Defect H — `route_two_slice` extractor matches backtick-quoted tag mentions

Discovered during smoke #5 induction. Commune body containing backtick-quoted literal mentions of `<project-context>` inside its `<live-context>` slice caused the project-slice extractor to grab text from the live-context body (rather than the actual project-context envelope contents) and write the malformed body to `projects/claude_skill_owl/todlando.md`.

- Root cause: extractor uses first-occurrence substring search; doesn't ignore backtick-fenced or code-quoted tag mentions
- Severity: medium (correctness; rare real-world repro)
- Coverage gap: no existing inline test uses backtick-quoted tag mentions inside slice bodies
- Filed: `.planning/debug/extractor-literal-tag-mention-todlando.md`
- Carry: Plan 25.3-07 (gap closure for Defect H) or schedule separately
- NOT blocking Phase 25.3 approval — 26/26 must-haves for original defect set (A/B2/C/D + E/F/G/G2 + ANSI) hold

## Operator Decision (2026-05-23)

approved — Phase 25.3 closed with Defect H carried as separate follow-up.
