Skip to content

Conversation

@betterclever
Copy link
Contributor

Summary

This PR fixes several issues related to dynamic port resolution and the Script node editor:

Dynamic Port Resolution (Backend)

  • Resolve ports at workflow save time: The backend now resolves dynamic ports for each node when workflows are created/updated, storing them in the workflow definition
  • Get componentId from node.type field: Fixed lookup to use the correct field where component ID is stored
  • Import worker components: Added import to populate componentRegistry in workflows service

Frontend Improvements

  • Deserializer updates: Frontend now copies `dynamicInputs` and `dynamicOutputs` from the API response to node data
  • ScriptCodeEditor fixes:
    • No longer overwrites existing code when it lacks the expected structure
    • Added `dom` lib to Monaco for `console`, `fetch`, and other browser globals

Script Node Docker Runner

  • Changed Script component from `runner: { kind: 'inline' }` to `runner: { kind: 'docker' }`
  • Now uses `runComponentWithRunner()` for proper PTY/terminal integration
  • Enables Docker log streaming in the frontend terminal viewer

Testing

  • Verified dynamic ports render immediately when loading workflows
  • Script node shows actual saved code instead of default stub
  • Console/fetch work in Monaco editor without type errors
  • Docker logs stream properly for Script node execution

Commits

  1. `fix: resolve dynamic ports at workflow save time`
  2. `feat: Script node now uses Docker runner for terminal streaming`
  3. `fix: ScriptCodeEditor now preserves existing code on load`
  4. `fix: Add dom lib to Monaco for console/fetch globals`

- Backend: Add port resolution in parse() method when workflows are saved
- Backend: Get componentId from node.type field (where it's stored in graph)
- Backend: Import worker components to populate componentRegistry
- Backend: Add dynamicInputs/dynamicOutputs fields to WorkflowNodeDataSchema
- Frontend: Update deserializeNodes() to copy dynamic ports to node data

This ensures all dynamic input/output ports are resolved and persisted when
a workflow is saved, and rendered immediately when loaded in the frontend.

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Refactored logic-script component from inline to docker runner
- Uses runComponentWithRunner for proper PTY/terminal integration
- Enables Docker log streaming in the frontend terminal viewer
- Updated demo-threat-hunter.ts with:
  - Runtime input for threat feed URL
  - Human-readable workflow name
  - Cleaner secret management with reusable names

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Only initialize with default code when code is truly empty.
Don't overwrite user's existing code just because it lacks the
auto-generated type interfaces.

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
@betterclever betterclever merged commit ebc78de into main Dec 23, 2025
3 checks passed
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +111 to +115
const baseRunner: DockerRunnerConfig = {
kind: 'docker',
image: 'oven/bun:alpine',
entrypoint: 'sh',
command: ['-c', ''], // Will be set dynamically in execute()

Choose a reason for hiding this comment

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

P1 Badge Reinstate CPU/memory limits for Script Docker runs

The Script component now routes execution through the generic Docker runner but no longer applies the previous --memory 256m and --cpus 0.5 constraints from the direct docker run invocation. The new DockerRunnerConfig lacks any resource caps, and the SDK runner does not support them, so user scripts can now consume unbounded CPU/RAM (e.g., tight loops or large allocations) and destabilize the worker host. This is a regression in isolation and should be addressed either by adding resource-limit support to the runner or by reintroducing limits for this component.

Useful? React with 👍 / 👎.

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.

2 participants