docs(project): add codeapi integration research and feature plans#5142
docs(project): add codeapi integration research and feature plans#5142rschlaefli wants to merge 2 commits into
Conversation
Adds four reviewed planning documents to project/plans_future/: - RESEARCH-codeapi-integration.md: shared research base (capability envelope, JWT auth contract, exec API, identity mapping, load limits, evidence for code execution in tutoring, open infra questions) - PLAN-code-element-type.md: ElementType.CODE with sandbox-graded test cases via an async Hatchet grading seam (PENDING -> worker -> push/poll) - PLAN-chat-code-execution-tool.md: native AI-SDK execute_code tool for course chatbots (per-chatbot flag, credits fold-in, verify-and-guide prompt contract) - PLAN-codeapi-further-features.md: ranked further candidates and explicit exclusions (live-quiz deferred, first-party pipelines ruled out) All file:line claims verified against v3 @ d6c7772. Independently reviewed pre-commit (4-lens workflow + Codex cross-model); all findings integrated, see review record in the research doc.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Confidence Score: 5/5This looks safe to merge.
|
| Filename | Overview |
|---|---|
| project/plans_future/PLAN-chat-code-execution-tool.md | Adds the Mastra-targeted plan for a native chatbot code-execution tool. |
| project/plans_future/PLAN-code-element-type.md | Adds the future CODE element plan with async grading, persistence gates, UI scope, and implementation slices. |
| project/plans_future/PLAN-codeapi-further-features.md | Adds ranked follow-on feature candidates and sequencing for codeapi-related work. |
| project/plans_future/RESEARCH-codeapi-integration.md | Adds shared research on codeapi behavior, limits, auth, APIs, and integration assumptions. |
Reviews (2): Last reviewed commit: "docs(project): retarget chat code-execut..." | Re-trigger Greptile
| // v1: language fixed to python server-side; not model-controllable | ||
| }), | ||
| execute: async ({ code }) => { | ||
| const jwt = await mintCodeapiJwt({ sub: ctx.participantId }) // TTL ≤300s, server-side key |
There was a problem hiding this comment.
The tool template only passes sub into mintCodeapiJwt, while the research contract requires claims such as iss, aud, jti, iat, nbf, exp, principal_source, and auth_context_hash. If the implementation follows this snippet literally, every POST /v1/exec call can be rejected by codeapi authentication instead of returning sandbox output.
Context Used: CLAUDE.md (source)
…tack - chat tool becomes a Mastra createTool via chat-engine AgentExtras.tools, wired host-side in apps/chat-api (PR #5126); flag gate stays host-side - credits: imageDescriptionCost fold-in pattern survives in chat-api finish+abort - add explicit 'why inline await, not Hatchet' rationale section - codeapi client + JWT minter now planned as shared packages/ module (chat-api + future CODE-element Hatchet worker) - CODE element plan unaffected by migration (note added)
What This Adds
This PR adds four planning documents to
project/plans_future/that design how KlickerUZH can use the DF self-hosted sandboxed code-execution service (codeapi, already live in production for DF LibreChat):RESEARCH-codeapi-integration.md— shared research base: the sandbox capability envelope (5 runtimes, no egress, no runtime installs, 5-min wall), the Bearer-JWT auth contract and required claims, the exec/upload/download API shapes, a recommended Klicker identity mapping (tenant_id= one Klicker-wide tenant,sub= participantId), classroom load limits, and evidence that code execution helps tutoring accuracy (PAL ICML 2023, Khanmigo).PLAN-code-element-type.md— deep plan for a newElementType.CODE: students write Python in a CodeMirror editor, submissions run against instructor-defined test cases in the sandbox, weighted partial credit flows through the existing evaluation machinery. Grading goes through a new async seam (PENDING → Hatchet durable task → subscription/poll) because the current synchronous grading transaction cannot host a 1–300s sandbox call. Includes a full touchpoint checklist across ~10 packages, surface staging (practice quiz + microlearning first, live quiz deferred), 7 implementation slices, and a 10–15 dev-day estimate.PLAN-chat-code-execution-tool.md— nativeexecute_codetool for course chatbots (deliberately NOT an MCP server), targeting the Mastra chat stack (PR feat(chat): add Mastra chat-api prototype and OpenRouter smoke #5126apps/chat-api+packages/chat-engine): MastracreateToolinjected via the engine'sAgentExtras.toolsseam, per-chatbotenableCodeExecutionflag gated host-side, credit cost fold-in following theimageDescriptionCostpattern (which survives in chat-api), verify-and-guide prompt contract, tool UI via the existingmakeAssistantToolUIpattern. Includes an explicit "why inline await, not Hatchet" rationale. 5 slices, 3–5 dev-day estimate. The pre-Mastra (directapps/chatroute) variant is preserved in git history (832579e56).PLAN-codeapi-further-features.md— ranked follow-on candidates (rehypePrism syntax highlighting first, group-activity code tasks, instructor authoring aid, tutor-runs-student-code bridge) with explicit exclusions and an overall sequencing recommendation.Important Details
v3file:line references were verified againstd6c7772f8; Mastra-stack references were verified againstcodex/mastra-chat-openrouter-smoke(PR feat(chat): add Mastra chat-api prototype and OpenRouter smoke #5126, 2026-07-12).QuestionResponseschema invariants (persistence model is now an explicit slice-1 gate), worker-side grading finalization must cover all side effects of today's grading transaction (sharedfinalizeQuestionResponsehelper), and the student client needs a reload-safe pending-state machine.201af9263) retargets the chat-tool plan at the Mastra migration: same architecture and estimates, new seam/file refs, sharedpackages/codeapi-client module (consumed by chat-api now, the CODE element's Hatchet worker later), and a sequencing note to build after PR feat(chat): add Mastra chat-api prototype and OpenRouter smoke #5126 merges. The CODE element plan is unaffected by the migration (note added).plans_future/(speculative, no implementation branch) per the existingproject/conventions.Branch Coverage
v3201af9263832579e56+ Mastra retarget201af9263), 4 files, 426 insertions(+) vs v3, docs only.Review Focus
Verification
Current head:
git diff --stat origin/v3...HEAD-> 4 files changed, 426 insertions(+), all underproject/plans_future/codex/mastra-chat-openrouter-smoke(agent.ts tool seam, chat-api tool merge + maxSteps + credit fold-in, mcp.ts namespacing) and Mastra docs (createToolcontext.abortSignal, toModelOutput)Earlier branch verification:
832579e56-> findings integrated, record inRESEARCH-codeapi-integration.md; the Mastra retarget was a targeted docs revision without a second external round (noted in the review record)Not run:
Blocking Before Merge
None (docs only). Merge whenever the plans are agreed; implementation would start on separate branches per plan.
Follow-Up After Merge
principal_sourceallow-list decision, sandbox package-set audit) before starting the CODE element build.rehypePrisminpackages/markdown(dep already present, import commented out).