Skip to content

feat(connect-interviews): schema + 3 atoms for V1 automation#386

Merged
jjackson merged 2 commits into
mainfrom
emdash/ocs-vw0t6
May 21, 2026
Merged

feat(connect-interviews): schema + 3 atoms for V1 automation#386
jjackson merged 2 commits into
mainfrom
emdash/ocs-vw0t6

Conversation

@jjackson
Copy link
Copy Markdown
Owner

Summary

Foundation for ACE-automated Dimagi Connect Interviews launches. Adopts the "ACE owns end-to-end" model: HQ domain creation, Connect-program creation, and OCS bot construction all flow through atoms rather than human UI clicks.

  • Schema (docs/connect-interviews/checklist-schema.yaml): structured form of the team's two prose checklists (domain-config gsheet + opp-creation gdoc) plus OCS-side rules from the technical design doc. 3 per_program + 24 per_domain + 25 per_cohort + 1 per_user items. atom_gaps enumerates 15 read + 18 write + 6 OCS authoring atoms still to build; 19 existing atoms reused for the rest.
  • 3 new atoms shipped:
    • commcare_create_domain — drives /register/domain/ form. Verified end-to-end (created ace-interviews-master, ace-interviews-test).
    • commcare_link_domains — jQuery-RMI to /a/<upstream>/remote_link/service/. Code complete; currently 403s pending Pro Edition provisioning by accounts@.
    • ocs_create_chatbot — POSTs chatbots/new/ form. Verified end-to-end (created ACE Interviews Stub Template, experiment 12213, pipeline 5981).
  • 3 probe scripts under scripts/probe-commcare-{create,link}-domains.ts + scripts/probe-ocs-create-chatbot.ts. All verified against live infra.

Live infrastructure now exists

  • HQ: ace-interviews-master, ace-interviews-test (Free tier; subscription email pending)
  • Connect: program ace-interviews-test in ai-demo-space (id f65e0633-cdb2-4d93-875a-b237ed241b18)
  • OCS: stub bot in connect-ace team (experiment 12213)

Up next (separate PRs)

  • 4 more OCS authoring atoms (ocs_add_pipeline_node, ocs_add_chatbot_event, ocs_add_custom_action, ocs_link_action_to_node) to flesh out the stub bot's structure
  • 14 REST-clean commcare_* atoms (users, cases, lookup tables, app releases, linked-domain push)
  • ~6 HTTP-driveable commcare_* atoms (conditional alerts CSV, user fields hidden-JSON)
  • ~9 form-Playwright commcare_* atoms (motech surface — connections, repeaters, form forwarders)
  • 3 skills composing the atoms (/ace:interview-domain-bootstrap, /ace:interview-cohort-create, /ace:interview-opp-verify)

Test plan

  • npx tsx scripts/probe-commcare-create-domain.ts --commit — created 2 domains
  • npx tsx scripts/probe-commcare-link-domains.ts --commit — 403 confirmed gated on Pro Edition
  • npx tsx scripts/probe-ocs-create-chatbot.ts --commit — created stub bot
  • YAML parse validation on schema file
  • Integration tests for new atoms (deferred until full atom batch lands)

🤖 Generated with Claude Code

Foundation for ACE-automated Connect Interviews launches. Bumps adopt the
"ACE owns end-to-end" model: HQ domain creation, Connect-program creation,
OCS bot construction all go through atoms rather than human UI clicks.

Schema (docs/connect-interviews/checklist-schema.yaml): structured form of
the team's two prose checklists (domain-config gsheet + opp-creation
gdoc), plus OCS-side rules derived from the technical design doc. 3
per_program items, 24 per_domain (HQ plumbing + OCS bot structure), 25
per_cohort (apps + lookup rows + Connect opp + payment unit + OCS
interview nodes), 1 per_user. atom_gaps section enumerates 15 read + 18
write + 6 OCS authoring atoms needed; existing atoms (19) reused for the
rest. README + probe-report.md companions.

New atoms (3 of ~39):
  - commcare_create_domain: POST /register/domain/ via DomainRegistrationForm.
    Handles known failure modes (name-taken, daily-limit, RESTRICT_DOMAIN_
    CREATION) with explicit errors. Used to create ace-interviews-master
    + ace-interviews-test for V1 round-trip.

  - commcare_link_domains: jQuery-RMI POST to /a/<upstream>/remote_link/
    service/ with Djng-Remote-Method: create_domain_link header. Gated by
    LITE_RELEASE_MANAGEMENT (Pro Edition) — currently 403s on the new
    domains; unblocks once accounts@ provisions Pro.

  - ocs_create_chatbot: POST /a/<team>/chatbots/new/ via ChatbotForm.
    Used to create the V1 stub Dynamic Router Bot template
    (experiment 12213, pipeline 5981 in connect-ace team).

3 probe scripts (probe-commcare-create-domain, -link-domains,
-ocs-create-chatbot) — verified end-to-end against live HQ + OCS.

Connect program "ACE Interviews Test" created in ai-demo-space (id
f65e0633-cdb2-4d93-875a-b237ed241b18, slug ace-interviews-test).
Subscription request sent to accounts@ for Pro Edition on the two new
HQ domains.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@jjackson jjackson enabled auto-merge May 21, 2026 23:00
Second OCS authoring atom (2/5 in task #13). Splices nodes into a
chatbot's pipeline graph via the existing /a/<team>/pipelines/data/<id>/
GET-mutate-POST pattern. Supports the common case of inserting a node
between two existing ones via disconnect_edge + connect_from + connect_to.

Live-verified by splicing StaticRouterNode between the Start and
LLMResponseWithPrompt nodes of the ACE Interviews Stub Template
(experiment 12213, pipeline 5981).

Findings captured for future OCS authoring work:
  - Each node carries TWO type fields: top-level React-Flow `type`
    ("startNode" | "endNode" | "pipelineNode") AND `data.type` (the
    OCS class name like "StaticRouterNode"). Both required by the
    pipeline-save endpoint. Without the top-level type, OCS 500s.
  - Edges need sourceHandle ("output") + targetHandle ("input"). Multi-
    output nodes use "output_0", "output_1" etc. but the defaults work
    for simple wiring.
  - data.id must mirror top-level id.
  - OCS pipeline-save validates AFTER commit: 200 + node-level errors
    in the response body, but the save IS persisted. Caller must check
    response errors even though status is success.
  - "DynamicRouterNode" doesn't exist server-side. The team's "Dynamic
    Router Bot" architecture maps to OCS's StaticRouterNode (routes by
    participant-data field values via the `keywords` array).
  - StaticRouterNode requires `name` + `route_key` params.

Schema:
  - FlowNode now carries optional top-level `type` + `data.id`.
  - FlowEdge now carries optional sourceHandle/targetHandle.

pipeline-patch.ts error path: pipeline-save POST failures now surface the
response body (truncated to 800 chars) and sniff Django exception_value /
title from HTML error pages. Surfaced the missing required-field issue
that was hidden behind the previous generic error message.

probe-ocs-add-pipeline-node.ts — verified end-to-end against live OCS.
probe-ocs-peek-raw.ts — small diagnostic for dumping the full pipeline
JSON (useful when debugging shape mismatches).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@jjackson jjackson closed this May 21, 2026
auto-merge was automatically disabled May 21, 2026 23:31

Pull request was closed

@jjackson jjackson reopened this May 21, 2026
@jjackson jjackson merged commit d848017 into main May 21, 2026
2 checks passed
jjackson added a commit that referenced this pull request May 21, 2026
Completes the 5-atom OCS authoring batch (1 was in PR #386). Together
these atoms let ACE construct a full Connect Interviews Dynamic Router
Bot from scratch, no human UI clicks.

New atoms (all verified end-to-end against live OCS):
  - ocs_add_chatbot_event — POST events/timeout/new/ with the THREE
    combined forms (TimeoutTriggerForm + EventActionForm + action-params).
    Verified: attached 24hr timeout event to stub bot (action_type=log).
  - ocs_add_custom_action — POST /a/<team>/actions/new/ (NOT
    /custom-actions/ as the original probe report said). OpenAPI-schema-
    driven, not webhook config. Scrapes /actions/table/ to recover the
    new action_id since the 302 redirect goes to the team-manage page
    with no id in the Location. Verified: created action 35 with a stub
    schema for HQ session-completion posting.
  - ocs_link_action_to_node — appends "<action_id>:<operation_id>" to a
    pipeline node's data.params.custom_actions. String format verified
    against apps/custom_actions/form_utils.py:make_model_id. Idempotent.
    Verified: wired action 35:postSessionCompletion to LLM node in
    pipeline 5981.

Verification doc (docs/connect-interviews/ocs-verification.md) corrects
multiple wrong claims from the original ocs-probe-report.md:
  - custom action URL is /a/<team>/actions/, not /custom-actions/
  - CustomActionForm fields are OpenAPI-driven (name, server_url,
    api_schema, +optional description/prompt/auth_provider/healthcheck_path)
    NOT the simple-webhook fields the probe report claimed
  - Events cannot directly fire custom_actions — ACTION_PARAMS_FORMS only
    has {log, send_message_to_bot, end_conversation, schedule_trigger,
    pipeline_start}. The tech doc's "24hr fires custom action" pattern
    requires a secondary pipeline + action_type=pipeline_start.
  - DynamicRouterNode doesn't exist — use StaticRouterNode (route_key +
    keywords against participant_data)
  - Pipeline-save validates AFTER commit (200 + errors in body but state
    persists); FlowNode needs both top-level type + data.type + data.id.

Stub bot now structurally complete:
  - experiment 12213 (ACE Interviews Stub Template) in team connect-ace
  - pipeline 5981: Start → StaticRouterNode-8f9a7 → LLM (custom_actions=
    ["35:postSessionCompletion"]) → End
  - 24hr timeout event attached
  - action 35 (session-completion API stub)

Tasks #3 and #13 → completed. PR builds on top of #386 (merged).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
jjackson added a commit that referenced this pull request May 22, 2026
  - /ace:interview-domain-bootstrap → skill orchestrates per-domain
    plumbing using the atoms shipped in PRs #386-393. Walks per_domain
    section of checklist-schema.yaml; documents 4 manual-fallback steps
    (subscription, UCR expression create, custom-data-field, conditional
    alert) where atoms are gap-tagged.

  - /ace:interview-cohort-create → skill orchestrates per-cohort launch.
    Takes a Cohort tracker-style YAML; runs the per_cohort section of
    the schema. Manual fallbacks: linked-app copy, user-field choice
    add, conditional alert create, OCS router-keywords update.

  - /ace:interview-opp-verify → read-only verifier. Walks every rule
    in checklist-schema.yaml against a live opp; produces a pass /
    fail / unverifiable / out_of_band report. Cross-system consistency
    checks included (OCS custom action target URL == HQ Inbound API URL).
    Exit codes 0/1/2 for clean/fail/unverifiable.

Each skill points at its slash command + the canonical schema doc.
Manual-fallback steps are explicit prompts; atoms for those land in V1.5.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant