Skip to content

feat: Terminal Bench Workflow Agent + one shot ferment workflow - #940

Open
pmateusz wants to merge 1 commit into
masterfrom
feat/workflow-agent
Open

feat: Terminal Bench Workflow Agent + one shot ferment workflow#940
pmateusz wants to merge 1 commit into
masterfrom
feat/workflow-agent

Conversation

@pmateusz

Copy link
Copy Markdown
Contributor

Linked issue

Closes #0

What does this PR do?

Adds a WorkflowAgent to the terminal-bench-2 harness that runs a named workflow via the kimchi-workflows extension instead of kimchi's default chat loop. This allows benchmarking different workflow implementations against stock kimchi under identical conditions.

Ferment-oneshot workflow (workflows/ferment-oneshot.workflow.ts)

Checklist

  • I have read CONTRIBUTING.md and agree to the CLA
  • This PR links to an open issue above
  • Tests pass locally (pnpm run test)
  • Lint passes (pnpm run check)
  • Documentation updated if behavior changed

@readme-ai-writer

readme-ai-writer Bot commented Jul 29, 2026

Copy link
Copy Markdown

📚 No documentation changes were needed for this PR.

@kimchi-review

kimchi-review Bot commented Jul 29, 2026

Copy link
Copy Markdown

Kimchi Code Review

Property Value
Commit 3a33be2
Author @pmateusz
Files changed 0
Review status Completed
Comments 4 (1 critical, 3 warning)
Duration 302s

Summary

📊 Review Score: 80/100 (overall code quality — 0 lowest, 100 highest)
⏱️ Estimated effort to review: 4/5 (1 = trivial, 5 = very complex)

🧪 Tests: yes — The PR adds substantial test coverage: agent_test.py guards the new Kimchi extension/seam hooks, workflow_agent_test.py covers WorkflowAgent construction, launch command, install/upload, stdin handling, and identity; workflow_extension_test.py covers npm/dir resolution, caching, and provenance; and conformance_test.py parameterises the contract across Kimchi and WorkflowAgent.

🔒 Security concerns found: workflow_extension.py runs npm install --omit=dev --omit=peer on an arbitrary npm: extension spec without --ignore-scripts, allowing a malicious or compromised package to execute arbitrary postinstall code on the benchmark host during resolution.

📝 Found 4 issue(s). See inline comments for details.

What to expect

Kimchi will analyze the changes in this pull request and post:

  • A summary of the overall changes
  • Inline comments on specific lines with findings categorized by issue type

The review typically completes within a few minutes. This comment will be updated once the review is ready.

Interact with Kimchi
  • @getkimchi review — re-trigger a full review on the latest commit
  • @getkimchi summary — regenerate the PR summary
  • @getkimchi ignore — skip this PR (no review will be posted)
  • Reply to any inline comment to ask follow-up questions or request clarification
Configuration

Reviews are configured by your organization admin.
Review instructions, excluded directories, and severity thresholds can be adjusted per repository in the Kimchi dashboard.


Powered by Kimchi — AI-powered code review by CAST AI

@pmateusz
pmateusz force-pushed the feat/workflow-agent branch from 3a33be2 to ba76439 Compare July 29, 2026 16:59

@kimchi-review kimchi-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📊 Review Score: 80/100 (overall code quality — 0 lowest, 100 highest)
⏱️ Estimated effort to review: 4/5 (1 = trivial, 5 = very complex)

🧪 Tests: yes — The PR adds substantial test coverage: agent_test.py guards the new Kimchi extension/seam hooks, workflow_agent_test.py covers WorkflowAgent construction, launch command, install/upload, stdin handling, and identity; workflow_extension_test.py covers npm/dir resolution, caching, and provenance; and conformance_test.py parameterises the contract across Kimchi and WorkflowAgent.

🔒 Security concerns found: workflow_extension.py runs npm install --omit=dev --omit=peer on an arbitrary npm: extension spec without --ignore-scripts, allowing a malicious or compromised package to execute arbitrary postinstall code on the benchmark host during resolution.

📝 Found 4 issue(s). See inline comments for details.

Comment thread benchmark/terminal-bench-2/src/kimchi_agent/workflow_extension.py
Comment thread benchmark/terminal-bench-2/src/kimchi_agent/workflow_extension.py Outdated
Comment thread benchmark/terminal-bench-2/src/kimchi_agent/workflow_agent.py
Comment thread benchmark/terminal-bench-2/src/kimchi_agent/workflow_agent.py
pmateusz added a commit that referenced this pull request Jul 30, 2026
Address four review comments on PR #940:

1. Security — --ignore-scripts on npm install
   The host-side `npm install --omit=dev --omit=peer` ran without
   `--ignore-scripts`, allowing a compromised extension's lifecycle
   scripts to execute on the benchmark host (which holds
   KIMCHI_API_KEY). Added the flag and extracted the command into a
   variable so the error message cannot drift from the invocation.
   New test reaches past the injectable seam to verify the real
   implementation includes it — every other test fakes the seam,
   so without this the flag could silently disappear.

2. Concurrency — safe cache publish without in-place rmtree
   Replaced `shutil.rmtree(cache_dir)` + `staging.rename(cache_dir)`
   with `_publish_npm_cache_entry`: try rename first, reuse a complete
   entry if another process won the race, quarantine a stale leftover
   and rename-aside rather than deleting where a concurrent reader
   may be uploading. Two new tests cover the mid-install race and the
   stale-leftover replacement.

3. Bug — workflow guard scanned source tree, not staged upload
   The `glob("*.workflow.ts")` guard checked the source directory,
   which contains `node_modules/@kimchi-dev/kimchi-workflows/.../
   create.workflow.ts` that the upload filter strips — a false
   positive. Replaced with `_assert_a_workflow_can_resolve` which
   scans the staged copy (what actually reaches the container)
   and distinguishes name-based vs path-based workflow references:
   a name only resolves at top level (discoverWorkflows is
   non-recursive), a .ts path reaches nested files. Three tests
   pin each case.

4. Maintainability — document intentional unfiltered dir: upload
   The `dir:` extension upload is unfiltered by design (the extension
   needs its node_modules/jiti). Added a comment explaining the
   trade-off and updated workflows/README.md to document that the
   workflows directory is filtered via WORKFLOWS_UPLOAD_IGNORE and
   that dev scaffolding never reaches the container.
@pmateusz
pmateusz force-pushed the feat/workflow-agent branch from 96d4552 to 7683811 Compare July 30, 2026 10:22
Runs a named kimchi-workflows workflow instead of kimchi's default chat
loop, so workflow implementations can be benchmarked against stock kimchi
under identical conditions. Extension specs resolve on the host and upload
to the container, since task images have no Node toolchain.

Kimchi gains three composition hooks; conformance_test.py pins both agents
to the same result.json shape. Also updates retired default model ids.
@pmateusz
pmateusz force-pushed the feat/workflow-agent branch from 7683811 to 9b221ca Compare July 30, 2026 10:47
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