Skip to content

feat(personas): minimal Mode 1 workflow DSL E2E persona#161

Open
khaliqgant wants to merge 1 commit into
mainfrom
feat/e2e-mode1-workflow-persona
Open

feat(personas): minimal Mode 1 workflow DSL E2E persona#161
khaliqgant wants to merge 1 commit into
mainfrom
feat/e2e-mode1-workflow-persona

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

Summary

  • Adds personas/e2e-mode1-workflow — a typed Mode 1 (workflow-DSL) persona that proves the ctx.workflow.run(...) execution path end-to-end with the smallest possible workflow.
  • The persona's handler materializes a 3-step deterministic DSL DAG via ctx.files.write('workflows/<name>.ts', ...), invokes it via ctx.workflow.run(...), awaits completion(), then writes back two GitHub comments via ctx.github.comment — one ack carrying the run id, one carrying the workflow-computed first line of the issue body.
  • Authored as persona.ts via definePersona, compiled to persona.json via agentworkforce persona compile. Mirrors the sibling e2e-mode2-hello persona's shape but adds the workflow-DSL tier on top.

Mode 1 vs. Mode 2

Per project_proactive_agent_three_modes:

  • Mode 1 (this PR) — a persona expressed as a workflow DSL (declarative steps). The @agent-relay/sdk/workflows DSL is a builder (workflow(name).pattern('dag').step(...).step(...).run()) authored as a separate .ts file under workflows/. The persona handler is a thin orchestrator that materializes the DSL source and calls ctx.workflow.run(name, args), which POSTs the source to the cloud workflows API for execution in daytona. persona-kit does NOT have a first-class workflow: / steps: field on PersonaSpec — Mode 1 lives as an external workflow source invoked by the handler.
  • Mode 2 — personas/e2e-mode2-hello. Single agent.ts handler that does everything inline. No workflow invocation.

The split here (workflow DSL does compute; handler does integration writeback via ctx.github.comment) is the canonical pattern shown in cloud-small-issue-codex's production-shipped agent. The DSL has no first-class "post GitHub comment" primitive — providers are reached through the runtime's ctx.<provider> clients on the handler side.

The workflow DAG

Three deterministic shell steps with explicit dependsOn edges that exercise inter-step data flow:

  1. extract-body — writes event.payload.issue.body to /tmp/e2e-mode1-<n>/body.txt.
  2. acknowledge — depends on extract-body. Reads body.txt's byte count, writes ack.txt. Proves step 2 sees step 1's filesystem effects.
  3. summarize — depends on acknowledge. Reads body.txt, extracts the first non-empty line, writes summary.txt AND echoes it to stdout with a stable marker (E2E_MODE1_FIRST_LINE=...) so the handler can recover it from completion.output.

Deploy

$ node packages/agentworkforce/bin/agentworkforce.js persona compile personas/e2e-mode1-workflow/persona.ts
Compiled .../persona.ts -> .../persona.json (e2e-mode1-workflow)

$ node packages/agentworkforce/bin/agentworkforce.js deploy personas/e2e-mode1-workflow/persona.json --mode cloud --on-exists update
...
cloud: deployment 893e523d-093c-4a74-b056-318b202ceaab created for agent 7dbf9fb6-e533-4f22-b93c-5c86bdcd8346
launched: cloud/7dbf9fb6-e533-4f22-b93c-5c86bdcd8346
ok: e2e-mode1-workflow (mode=cloud, workspace=50587328-...)

Live E2E status

Live trigger fire is gated on the cloud-side snapshot fix (cloud#1349, currently open) landing + deploying. The persona is authored, compiled, and successfully deployed to the cloud — but firing a workflow-test-labeled issue will not exercise the full path until the daytona sandbox can boot the workflow runtime cleanly again.

Test plan

  • persona compile produces a valid persona.json with onEvent: ./agent.ts and the github issues.opened trigger.
  • deploy --mode cloud --on-exists update returns a deployment id and reports ok (verified twice — initial + clean redeploy after dropping the unknown issues.labeled trigger).
  • Open a fresh issue on AgentWorkforce/cloud with the workflow-test label and confirm both comments arrive in step order. Blocked on cloud#1349 deploy.

Implementation notes / gotchas

  • harness: 'codex' + model: 'gpt-5' + systemPrompt are stubbed even though this is a pure-handler persona that never calls ctx.harness.run. The cloud-side validator requires them (rejects 400 invalid_persona otherwise), even though persona-kit's parser is fine with omitting them for handler-style personas. Mirrors e2e-mode2-hello's shape.
  • Dropped issues.labeled from the triggers (warned by the deploy linter: "not in the known-trigger registry for github"). Re-firing requires close+reopen rather than re-adding the label.

🤖 Generated with Claude Code

Adds personas/e2e-mode1-workflow — a typed Mode 1 (workflow-DSL handler)
persona that listens for GitHub `issues.opened` on AgentWorkforce/cloud
labeled `workflow-test`, materializes a 3-step deterministic workflow
DSL DAG via ctx.files.write, invokes it via ctx.workflow.run, and posts
two GitHub comments back via ctx.github.comment carrying the workflow's
computed output (the issue body's first line).

Exists to prove the Mode 1 path (proactive trigger -> handler ->
ctx.workflow.run -> cloud workflows API -> daytona DAG -> completion
poll -> back-channel write) end-to-end with the smallest possible
workflow — three deterministic steps with inter-step data flow through
a known /tmp working dir. No clone, no agent step, no PR machinery.

Authored as persona.ts via definePersona, compiled to persona.json via
`agentworkforce persona compile`. Mirrors the structure of the sibling
e2e-mode2-hello persona but adds the workflow-DSL invocation tier.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Warning

Review limit reached

@khaliqgant, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 54 minutes and 38 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b582b525-00a0-4736-8592-356e24dac1db

📥 Commits

Reviewing files that changed from the base of the PR and between 17d62f6 and 35d154b.

📒 Files selected for processing (4)
  • personas/e2e-mode1-workflow/agent.ts
  • personas/e2e-mode1-workflow/package.json
  • personas/e2e-mode1-workflow/persona.json
  • personas/e2e-mode1-workflow/persona.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/e2e-mode1-workflow-persona

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="personas/e2e-mode1-workflow/agent.ts">

<violation number="1" location="personas/e2e-mode1-workflow/agent.ts:232">
P2: Marker parse break on object output. JSON stringify adds escapes, regex can capture junk. Read plain stdout field before fallback.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

// ─── completion-output helpers ─────────────────────────────────────────────

function extractFirstLineMarker(output: unknown): string | null {
const text = typeof output === 'string' ? output : safeStringify(output);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Marker parse break on object output. JSON stringify adds escapes, regex can capture junk. Read plain stdout field before fallback.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At personas/e2e-mode1-workflow/agent.ts, line 232:

<comment>Marker parse break on object output. JSON stringify adds escapes, regex can capture junk. Read plain stdout field before fallback.</comment>

<file context>
@@ -0,0 +1,281 @@
+// ─── completion-output helpers ─────────────────────────────────────────────
+
+function extractFirstLineMarker(output: unknown): string | null {
+  const text = typeof output === 'string' ? output : safeStringify(output);
+  if (!text) return null;
+  const match = text.match(/E2E_MODE1_FIRST_LINE=([^\n\r]*)/);
</file context>

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