CedarCopilot wants to merge 0 commits into staging from fix/sherlock-sequencer-em-dash-signature-20260914-150416
Live on prod since Mon, 3 of 5 surfaces working
Verification reached its 130s outer budget before the verifier returned. Libra is keeping this intent verifying until the next check.
Libra measured 3 of 5 production surfaces on prod. 2 surfaces had under 20 requests, so Libra has not judged them. Libra checks hourly for 3 days after each deploy.
Jacob Doty (Aspire) reported his "Zeke the Sequencer" outbound agent was still using em dashes and an inconsistent email signature despite already having explicit "no em dashes" and "sign off as Jacob" rules in its subagent doc.
Root cause traced via Sherlock (Postgres chat_messages for the Slack thread slack:T02511TSJ:C0C0XC2FAR4:1789410187.953389, 2026-09-14):
spawn-subagent(type="orchestrator", agentId="5a688ce6-c542-44ba-8a27-581317d3122a") , Zeke's real subagent."x-understudy-tags key 'userId' must match /^[a-z0-9][a-z0-9-]{0,63}$/"
orchestrator-agent.ts passes the raw Cedar userId straight into x-understudy-tags (WHJSsQgW9nP9xKHmjPkZtYgPwSbow2US , mixed case, no hyphens, per Better Auth's id format), which violates Understudy's required tag pattern. This breaks the call for every Cedar user, not just Jacob, whenever the cedar-understudy-orchestrator flag routes a spawn-subagent(type="orchestrator") call through the gateway.run-code-executor call with a freehand task description , which doesn't inherit any parent subagent's prompt, so none of Zeke's style rules (no em dash, sign off as Jacob) were ever in scope.understudyHeaders() (apps/server/src/services/llm/understudy.ts) now sanitizes every x-understudy-tags value , lowercases it, strips characters outside [a-z0-9-], strips leading hyphens, and truncates to 64 chars , before building the header. This is centralized so no future caller needs to separately learn Understudy's tag format.
Added test coverage in resolve-model.test.ts covering the exact mixed-case userId that broke this, plus an arbitrary tag with disallowed characters.
pnpm --filter @zero/server exec vitest run src/services/llm/__tests__/resolve-model.test.ts , 12/12 passing, including the two new sanitization cases.pnpm --filter @zero/server run types , clean.spawn-subagent(type="orchestrator") calls in agent_tool_calls for users with cedar-understudy-orchestrator enabled , they should no longer show a TOOL_EXECUTION_FAILED / x-understudy-tags 400 in the result, and should not be followed by a run-code-executor fallback for the same task.Separately (not in this PR , a live document edit, not code): Jacob's two sequencer subagent docs (zeke-the-sequencer.md, event-outreach-sequencer.md) were patched via writeDocumentGuarded to change the sign-off rule from "Jacob" (no dash) to "-Jacob" per his request, and verified via the playbook health + Yjs sync checks.
π€ Generated with Claude Code
https://claude.ai/code/session_01UPnwxwkTP5oh7k6MhZn97b
This PR centralizes normalization of Understudy tag values so Cedar identifiers satisfy the gatewayβs lowercase, character, leading-character, and length constraints.
x-understudy-tags.The PR appears safe to merge, with no concrete correctness, security, or repository-rule violations identified.
The sanitizer handles the documented character, first-character, empty-value, and maximum-length requirements, and the regression tests exercise the production failure that motivated the change.
| Filename | Overview |
|---|---|
| apps/server/src/services/llm/understudy. |
| Surface | Requests | Errors | p95 | Users | Verdict |
|---|---|---|---|---|---|
| model_chunk On-Event Execution Agent (Understudy) | 31 β 102 | 0 β 0 (0%) | 1 ms β 1 ms | 0 | Working 102 requests since the deploy with 0 errors (0 errors in the 31-request baseline before it). p95 1 ms, was 1 ms. |
| model_step On-Event Execution Agent (Understudy) | 10 β 30 | 0 β 0 (0%) | 23743 ms β 28865 ms | 0 | Working 30 requests since the deploy with 0 errors (0 errors in the 10-request baseline before it). p95 28865 ms, was 23743 ms. |
| model_chunk Automation Agent (Understudy) | 12 β 28 | 0 β 0 (0%) | 1 ms β 2 ms | 0 | Working 28 requests since the deploy with 0 errors (0 errors in the 12-request baseline before it). p95 2 ms, was 1 ms. |
| model_chunk On-Event Orchestrator Agent (Meeting, Understudy) | 4 β 10 | 0 β 0 (0%) | 1 ms β 1 ms | 0 | Insufficient traffic 10 requests, under the 20 Libra needs |
| model_step Automation Agent (Understudy) | 4 β 8 | 0 β 0 (0%) | 33865 ms β 848145 ms | 0 | Insufficient traffic 8 requests, under the 20 Libra needs |