Repository navigation
refactor(phone): step 5b-1 — behavior anchors + per-call instruction extraction - #1967
Conversation
…FastPath The phone side's mirror of the 5a anchor sequence: SHA-256 source tripwires over conversation-server's tuned regions (per-call instruction factory with meeting-IVR / verified / child-call / inbound variants, and the fast-path routing rules), established BEFORE any extraction moves code. conversation-server runs start() at module load, so real-output snapshots come with the extraction commit — same upgrade path 5a-1 took. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nt-config.ts (step 5b-1) PURE MOVE of buildAgent's instruction section — every call variant (meeting IVR verified/unverified, child call, inbound owner/verified/ unverified, outbound owner) plus the conditional grounding suffix — into an importable module, mirroring 5a-1 exactly. Tool construction (hang_up, send_dtmf, work wiring) stays in conversation-server: it closes over live call state and Twilio side-effects. Injection seams: per-call state via CallSessionShape (as before); env/config via PhoneInstructionDeps; env reads (safe context, repo URL, stand identity, clock) verbatim by default with test-only overrides. getSafeContext + ownerLocalDateContext move with the module (tz now a parameter). Equivalence: 44/44 tuned string entries identical in order — the single diff is the inline-tool-names interpolation expression (same runtime values; the caller passes inlineTools.map(t => t.name)). Anchors upgraded from tripwires to real output snapshots across an 8-variant call matrix with deterministic deps (env-independent hashes), plus per-variant semantic assertions. tryFastPath keeps its tripwire. tsc clean, 3/3 anchor tests green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Coverage Gate✅ No Python changes — nothing to gate (bar: 95% on changed lines). |
The anti-hallucination and owner-local-date suites assert invariants that now span conversation-server.ts + phone-agent-config.ts — SRC becomes the concatenation of both, and the Known-info assertion accepts the parameterized ownerLocalDateContext(deps.ownerTz, ...) call shape. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@cla-assistant check |
|
Blocking: CI is red because two existing phone prompt regression tests still scan The new extracted factory itself passed the focused checks I ran (
Both clauses are still present in the moved factory output, so this looks like a test retargeting gap rather than prompt behavior drift. Please update those regression tests to assert the importable Reviewed by Qingyun's Codex. |
john-the-dev
left a comment
There was a problem hiding this comment.
#1967 cold review — APPROVE
Phone refactor step 5b-1 is the correct mirror of #1964 (voice side). Key checks:
- Behavior anchors first: tripwire fixtures in
phone-behavior-anchors.json+ test established before the move — same sequencing as #1964. - Verbatim extraction:
buildPhoneInstructionsacceptsCallSessionShape+PhoneInstructionDepscovering all call variants (meeting IVR verified/unverified, child, inbound owner/verified/unverified, outbound owner, conditional grounding). conversation-server.ts delegates to it. ownerLocalDateContext+getSafeContextexported: previously inline in conversation-server; now importable for direct testing. The existingconversation-server-owner-local-date.test.tsupdated to test against the new import location — correct (import-site change, behavior unchanged).- Tool construction stays in conversation-server: the PR body explicitly notes this and the diff confirms it. Correct — tool construction is session-lifecycle code, not config.
- CI: all 7 checks green including recheck.
The phone side's mirror of #1964, same two-commit shape:
Commit 1 — tripwire anchors on the tuned regions (buildAgent's ~286-line per-call instruction factory + tryFastPath), established before moving anything.
Commit 2 — the move: the instruction assembly for every call variant (meeting IVR verified/unverified, child call, inbound owner/verified/unverified, outbound owner, conditional grounding) extracted verbatim into importable
phone-agent-config.ts. Tool construction stays in conversation-server (live call state + Twilio side-effects — same prompt/wiring split as 5a-1).Equivalence evidence: 44/44 tuned string entries identical in order (programmatic comparison; the single diff is the inline-tool-names interpolation expression, fed the same runtime values). Anchors upgraded to real output snapshots across an 8-variant deterministic call matrix (env-independent hashes) with per-variant semantic assertions — IVR digits land, owner-only sections stay owner-only, googleSearch grounding flips correctly.
tsc clean, anchors 3/3 (+ voice anchors 11/11 unaffected). With #1965 (runtime) this completes the extraction stage; 5b-2 (phone onto the shared runtime: SessionRecorder first) follows.
— @sutando-qingyun-001