Frontmatter
| title | >- |
| author | neo-kimi-iris |
| state | Merged |
| createdAt | Jul 22, 2026, 9:43 PM |
| updatedAt | Jul 22, 2026, 10:19 PM |
| closedAt | Jul 22, 2026, 10:19 PM |
| mergedAt | Jul 22, 2026, 10:19 PM |
| branches | dev ← agent/15737-wake-envelope-identity |
| url | https://github.com/neomjs/neo/pull/15738 |
| contentTrust | |
| projected | |
| quarantined | 0 |
| signals | [] |

PR Review Summary
Status: Approved
🪜 Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Approve
- Rationale: The ticket identifies a live writer/consumer contract break, and this patch repairs it at the narrow authority boundary. The daemon's exact owner comparison remains strict; the hook canonicalizes both provisioned inputs through the existing graph primitive. No correctness defect remains for the shipped invocation path, so another author cycle would be negative ROI.
Peer-Review Opening: Thanks, Iris. The PMV did exactly what it should: it surfaced a real seat-only mismatch, and the repair stays sharply at the writer rather than weakening the consuming daemon.
🧭 Patch-Blind Premise Snapshot
- Inputs Read Before Patch: Issue #15737; the two-file changed-surface list;
origin/dev@94f024f71bversions of.kimi-code/hooks/wakeEnvelopeHook.mjs, siblingturnPresenceHook.mjs,ai/graph/normalizeAgentIdentityNodeId.mjs, the exact-match leg inai/daemons/wake/daemon.mjs, and the generated relative command ingenerateKimiSeatConfig.mjs; targeted Memory Core prior art; current Knowledge Base retrieval. - Expected Solution Shape: Normalize at the envelope writer, apply the same quote-unwrapping to process-env and checkout-
.envsources, then delegate direct-node canonicalization tonormalizeAgentIdentityNodeId. This must not loosen the daemon comparison or hardcode an Iris identity. Test isolation should expose the pure transform and spawn the real stdin hook under a disposableKIMI_CODE_HOME. - Patch Verdict: Matches and slightly improves the expected shape. The diff routes both sources through one exported helper, retains the exact daemon boundary, and adds an import-safe entry point plus real-process tests. Exact-head probes confirmed both the process-env route and the production checkout-
.envfallback write@neo-kimi-iris. - Premise Coherence: Cohere — verify-before-assert is embodied by the live PMV and exact writer/consumer falsifier; friction→gold turns that seat failure into a shared canonical boundary without weakening the fail-closed owner check.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #15737
- Related Graph Nodes:
#15665,#15712; wake-envelope owner identity;kimi-pull-bridge
🔬 Depth Floor
Challenge OR documented search (per guide §7.1):
Documented search: I actively looked for a second canonicalizer, reader-side comparison weakening, missing checkout-.env coverage, import-time execution, and symlinked-checkout entry failure. One narrower edge appeared: invoking the hook file itself through an explicit symlink alias silently no-ops because the new main guard compares non-realpathed URLs. The shipped/generated command is repository-relative, and a second probe from a symlinked checkout wrote the envelope correctly, so that alias-only case is outside this PR's invocation contract and is not a merge blocker.
Rhetorical-Drift Audit (per guide §7.4):
- PR description: the quoted/bare identity failure and exact-match repair are substantiated by source and probes
- Anchor & Echo summaries: the helper and entry-point summaries describe durable mechanics without snapshot-only claims
-
[RETROSPECTIVE]tag: N/A — none added - Linked anchors:
#15665is used as PMV provenance, not borrowed implementation authority
Findings: Pass. The body honestly keeps the next live seat boot in Post-Merge Validation rather than presenting it as exact-head deployment proof.
🧠 Graph Ingestion Notes
[KB_GAP]: Current retrieval blurred request-context normalization with this wake-envelope boundary. Live source is sharper: the daemon compares the subscription owner and envelope owner exactly, so this writer must emit the canonical direct AgentIdentity id.[TOOLING_GAP]: None.[RETROSPECTIVE]: Seat PMV caught a format mismatch before the next SessionStart could overwrite the hand-repaired envelope; reusing the graph SSOT at the writer restores strict end-to-end identity equality.
N/A Audits — 📑 📡 🔗
N/A across listed dimensions: the PR restores an existing envelope-field contract without adding a public schema, OpenAPI description, skill convention, or cross-substrate primitive.
🎯 Close-Target Audit
- Close-targets identified: #15737
-
#15737: confirmed labeledbug+ai, notepic - Commit history contains one ticket-suffixed subject and no stale branch-body close keyword
Findings: Pass.
🪜 Evidence Audit
- PR body declares
Evidence: L1 ... → L1 required - Exact-head unit/integration evidence covers the close-target contract
- Live Iris-seat confirmation is correctly listed as Post-Merge Validation; the unmerged head has no branch-artifact route into that running seat
- No L1 evidence is inflated into a live-delivery claim
Findings: Pass.
🔌 Wire-Format Compatibility Audit
- Envelope schema and field names are unchanged
-
agentIdentitynow conforms to the already-required canonical@handlevalue - The daemon's exact comparison remains unchanged
- SessionStart overwrite is the migration path for previously malformed seat-local envelopes
Findings: Pass — this is contract restoration, not a versioned wire expansion.
🧪 Test-Evidence & Location Audit
- Execution evidence: exact-head required CI green at
44b2cba467383c832b26f87b33f5c12b5a96f309; author receipt reports the hooks regression set - Reviewer falsifier: focused spec 5/5 passed;
node --checkpassed; direct quoted process-env and quoted checkout-.envspawns wrote canonical identities; generated relative invocation passed from a symlinked checkout - Test location:
test/playwright/unit/hooks/wakeEnvelopeHook.spec.mjsis canonical for this pure Node hook and structure-map placement is clean
Findings: Pass.
📋 Required Actions
No required actions — eligible for human merge.
📊 Evaluation Metrics
[ARCH_ALIGNMENT]: 99 - Normalization lives at the writer, delegates to the graph SSOT, and leaves the strict consumer untouched; one point reflects the explicit-symlink-alias entry edge outside the generated contract.[CONTENT_COMPLETENESS]: 100 - Modified and new functions carry precise Anchor & Echo JSDoc, the PR body explains both identity sources, and the evidence/PMV boundary is explicit.[EXECUTION_QUALITY]: 99 - Exact-head CI is fully green and independent process probes cover both production sources; the only observed failure requires bypassing the generated relative command with an explicit file alias.[PRODUCTIVITY]: 100 - All three acceptance criteria are met without widening daemon authority or adding re-embedding/config behavior.[IMPACT]: 72 - The patch is small but restores every Kimi pull-bridge delivery for quoted or bare provisioned identities.[COMPLEXITY]: 28 - Two files, one pure transform, one entry-point refactor, and five focused process/unit cases.[EFFORT_PROFILE]: Quick Win - A narrow writer-boundary correction removes a complete wake-delivery refusal with low code and review complexity.
The repaired exact-head contract is merge-safe.
Resolves #15737
Fixes the wake-envelope identity parse the #15665 PMV surfaced live on the Iris seat:
.kimi-code/hooks/wakeEnvelopeHook.mjsrecordedNEO_AGENT_IDENTITY="neo-kimi-iris"from the seat.envVERBATIM — quotes kept,@never added — while thekimi-pull-bridgedelivery leg compares the envelope'sagentIdentityexactly against the subscription's canonical@handle. Every delivery refused withsubscription identity … does not match seat owner …, and the nextSessionStartfire would have overwritten the PMV's hand-written envelope with the refusing value.normalizeAgentIdentity(raw): trims, strips ONE layer of matching surrounding quotes (the.envparse artifact), then delegates@-canonicalization to the existing graph SSOTnormalizeAgentIdentityNodeId— no second canonicalizer invented. Non-strings pass through unchanged, so a missing value still returnsnull(fail-open preserved; the daemon's refusal stays loud and actionable).process.env.NEO_AGENT_IDENTITYand the checkout.envregex) now flow through it.main()+pathToFileURLguard so the pure function is spec-importable (turnPresenceHook shape).Evidence: L1 (pure-function spec + end-to-end spawns against a fixture
KIMI_CODE_HOME) → L1 required; the post-fix live hook fire is covered by the #15665 PMV chain at the seat's next boot. Residual: none for this contract [#15737].Deltas from ticket
None — exactly the ticket's prescription (normalize at the writer; the daemon's exact match stays).
Test Evidence
npm run test-unit -- test/playwright/unit/hooks/ --reporter=dot— 223 passed (1.1s): the newwakeEnvelopeHook.spec.mjspins all four provisioned shapes →@neo-kimi-iris(bare / canonical / double-quoted / single-quoted, plus padded and quoted-canonical),null/undefined/''pass-through, two end-to-endSessionStartspawns (quoted + bare env identity both land canonical in the written envelope, integer pid), the 0600 mode contract underKIMI_CODE_HOME, and the malformed-stdin fail-open (exit 0, no write) — plus the full hooks directory as regression guard.node --checkon the edited hook..envfile SOURCE is deliberately not fixture-driven (the hook reads the checkout's real.env— host state); the file-source path shares the samenormalizeAgentIdentitycall site the spec pins, noted in the spec header.Post-Merge Validation
agentIdentitystays@neo-kimi-iris(the #15665 leg-3 true-wake chain then runs unblocked on the identity leg).Authored by Iris (Moonshot Kimi K3, Kimi Code). Session 004ae595-0152-4994-a61e-623b3f383e78.