6.7 KiB
Emma Canonicalization Handoff
Scope
This handoff begins the controlled, phase-locked Emma canonicalization program.
The program uses one named phase per Gemini session, normally limited to 45–60 minutes. Each phase must start from command-proven Git and runtime state, stay inside its authorized scope, end with tests/diff/status, and stop.
Verified Baseline
- Repository:
~/OSVauco - Branch:
feat/opax-domain-decouple - Local HEAD:
c7c96efd12bb3f3cdcfe9309e7683f0d01c16366 - Subject:
fix(deploy): include MCP requirements in Cloud Build context - Date:
2026-09-19T12:39:31+00:00 - Local worktree status: clean when this handoff was prepared
- Remote status: local
c7c96efwas ahead oforigin/feat/opax-domain-decouplebefore the handoff push
Verified Public Health
https://opax.vauco.no/returned HTTP 200 with valid TLS.opax-mcpauthenticated health returnedstatus: ok.- The MCP health response reported the expected internal Ollama configuration.
- The public OPAX site and MCP service are distinct deployed services.
Active Runtime
OPAX MCP
- Cloud Run service:
opax-mcp - Active revision:
opax-mcp-00200-gcp - Traffic: 100%
- Image:
us-central1-docker.pkg.dev/propane-will-491900-m5/osvauco-repo/opax-mcp@sha256:8687cd7489e789c17f6a56985191d6d924fc03d35d28c78bf94fea8b17b83091
OPAX Web
- Cloud Run service:
opax-web - Active revision:
opax-web-00014-fnw - Traffic: 100%
- Revision creation:
2026-09-19T00:21:32.201043Z - Image:
us-central1-docker.pkg.dev/propane-will-491900-m5/osvauco-repo/opax-web@sha256:27105067393c607d97a4c44fffe54bdf1da6ce7a6dd662e114f039fc04d69892
Failed Acceptance Test
The live OPAX browser chat completed a basic response but failed the same-session conversation-continuity acceptance test.
Turn one
User:
Husk dette testtokenet kun i denne samtalen:
OPAX-EMMA-1909.
Svar bare: registrert
Assistant:
registrert
Turn two
User:
Hva var testtokenet jeg ba deg huske?
Assistant:
Jeg har ikke godkjent VAUCO-kontekst i denne chatten ennå...
This is a failed same-session continuity acceptance test.
Verified Local Source Path
The checked-out source contains the intended same-session history path:
Browser conversation state
→ OPAX Web frontend request history
→ OPAX Web BFF
→ MCP JSON-RPC arguments.history
→ opax-mcp run_emma
→ _normalize_emma_history
→ CanonicalEmma.run
→ _ollama_chat
→ Ollama messages payload
Verified local implementation characteristics:
opax-mcp/server.pyrun_emmapasses normalized request history tocanonical_emma.run._normalize_emma_historyretains onlyuserandassistantroles.- Blank messages are removed.
- The latest 40 historic messages are retained.
opax-mcp/emma_adapter.pyCanonicalEmma.runforwards history to its injected chat function.opax-mcp/server.py_ollama_chatplaces one canonical system prompt first, then history, then the current user prompt.- Firestore/Morphic persistence is not part of the current same-session
run_emmaroute.
Unverified Runtime Facts
The following must remain explicitly marked as unverified until supported by runtime payload evidence, deployed-source provenance, or focused tests:
- Whether active
opax-websends history in the real browser request. - Whether active
opax-webincludes the local history implementation. - Whether live Ollama receives the expected second-turn message sequence.
- Whether the active model uses valid history correctly after receiving it.
- Firestore/Morphic persistent-memory wiring.
- INCU ticket storage and execution wiring.
- Emma access to Gitea/Git context.
- Perplexity connector correctness.
Architecture Boundaries
- OPAX Web is the authenticated UI and BFF.
opax-mcpis the controlled model and tool gateway.- Emma is the canonical runtime/agent.
- Same-session history, persistent memory, INCU ticketing, Git context, Git writes, and Perplexity connectivity are separate phases.
- The browser and model must not receive raw credentials, unrestricted terminal access, or direct infrastructure authority.
- Consequential actions require explicit human approval, resolved targets, structured arguments, audit evidence, and a visible result.
- Historic client messages may contain only
userandassistantroles; historicsystemandtoolroles must not reach the model payload.
Phase Plan
- PHASE 0 — Runtime truth baseline.
- EMMA-SESSION-001A — No-network session-history regression tests.
- EMMA-SESSION-001B — Browser/BFF second-turn history-payload proof.
- EMMA-SESSION-001C — Controlled release and live token acceptance.
- EMMA-PERSIST-001 — Authenticated, user-scoped Firestore session persistence.
- INCU-TICKET-001 — INCU ticket proposal/review workflow; no execution.
- EMMA-GIT-READ-001 — Structured read-only Git/Gitea context.
- EMMA-PATCH-001 — Patch proposal and allowlisted local validation.
- EMMA-GIT-WRITE-001 — Explicit approval-gated Git write lane.
- MCP-PERPLEXITY-001 — Separate Perplexity connector repair.
Immediate Next Ticket
EMMA-SESSION-001A
Goal: Add no-network regression coverage for the existing local history path.
Required test coverage:
run_emmanormalizes and forwards valid historicuserandassistantmessages.- Historic
system,tool, malformed, blank, and non-string-content entries are excluded. _ollama_chatcreates this exact final ordering:
canonical system prompt
→ validated user/assistant history
→ current user prompt exactly once
Out of scope:
- Production code changes.
- Firestore or Morphic persistent memory.
- Git/Gitea access.
- INCU ticket execution.
- Commit, push, build, or deployment.
- Cloud Run, IAM, secrets, VPC, billing, or DNS changes.
Completion condition: Local no-network tests pass, diff is reviewed, and a human explicitly decides whether to commit.
New Gemini Session Contract
Every Gemini session must:
- Work on exactly one named phase.
- Begin with raw output from:
pwdgit branch --show-currentgit log -1git status --short
- Stop if the branch is not
feat/opax-domain-decouple. - Stop if unexpected modifications are present.
- Use exact source paths and line ranges.
- Mark unsupported claims as
UNVERIFIED. - Never invent Git SHAs, Cloud Run revisions, image digests, deployments, or test results.
- End with actual test results, exact diff, Git status, confirmed facts, unverified facts, and a hard stop.
Commit, push, build, deployment, Firestore writes, Gitea writes, Cloud Run changes, IAM changes, secret changes, VPC changes, and infrastructure actions require separate explicit approval.