Commit Graph

5063 Commits

Author SHA1 Message Date
116ec9dd04 Read the current implementation and consider the following problem (vibe-kanban 25d8b973)
Currently, the HumanInput node yields a `HumanInputFormFilledEvent` event while form is submmited. However, for form level timeout, current no event about timeout is emitted. This makes the frontend UI not updated while the events of time out are sent to the frontend.

Analysis this problem, propose a way to resolve this issue.
2026-01-27 08:46:41 +08:00
9bbe63c1d8 Implement a ratelimit for Web App Form endpoints (vibe-kanban 033e0d0d)
Prevent adversaries from brute-frocing the form token.
2026-01-27 07:49:50 +08:00
b59713b980 Return the form expired error code in get form definition in WEbAPp Api (vibe-kanban 758765b0) 2026-01-26 16:14:02 +08:00
6531267ec3 add a test to ensure ShardedBroadcastChannel Works as expected (vibe-kanban a25b7a4c)
I have fixed a bug in `_RedisShardedSubscription` in the latest commit. I need you to write an integration test case for this bug.

You should write the test in TDD way. You are free to change the git head.
2026-01-26 12:23:57 +08:00
80f55a625d fix(api): ensure action id is not empty if the form timeout 2026-01-26 11:46:24 +08:00
6277fc3b74 feat(api): Add configuration example for HITL related configuration 2026-01-26 08:52:04 +08:00
67bb3c2026 feat(api): enable human input timeout check 2026-01-26 08:40:28 +08:00
98d9dc620b fix(api): Prevent messages from being dropped.
This is cuased by an issue in upstream code:

If Sharded PubSub is used with Cluster, the `
ClusterPubSub.get_sharded_message` will return `None` regardless of
message['type'].
2026-01-26 00:32:08 +08:00
33a830cbc9 refactor(api): rename placeholder to default_value in various parts
Previously the fields / classes are named with `placeholder`. However,
the actual purpose is to use as default values. This commit addresses
this problem by correcting names for relevant fields / classes.

- FormInputPlaceholder
- FormInput.placeholder
- HumanInputRequiredResponse.resolved_placeholder_values
- HumanInputFormDefinition.resolved_placeholder_values
- FormCreateParams.resolved_placeholder_values
- HumanInputRequired.resolved_placeholder_values
- The `resolved_placeholder_values` argument of _create_human_input_delivery_test_form
- The `resolved_placeholder_values` inside _jsonify_form_definition
2026-01-23 15:05:18 +08:00
9e56d65612 fix(api): disconnect for state snapshots events 2026-01-21 17:44:19 +08:00
67c7ca7da7 Do not allow create WorkflowTool from workflows containing HumanInput nodes (vibe-kanban 9e27ac53)
The HumanInput node will pause the execution of workflow if execution, while WorkflowTool works in a blocking manner. (Receiving arguments and returning results once finished). The two mode are inherently incompatible.

The goal of this change is to forbid workflows containing HumanInput node being published as WorkflowTool.

Please check the current implementation and propose a solution.
2026-01-21 16:29:49 +08:00
05f9ea4220 chore(api): send a ping event immediately for /events api 2026-01-21 16:21:24 +08:00
073305e699 feat(api): publish a message_replace event with saved temporary answer
This ensures that the message content in frontend UI is properly
restored.
2026-01-21 15:56:32 +08:00
004df1c159 fix(api): fix connection closing issue for event subscription
The previous implementation does not close the connection once
`WORKFLOW_PAUSED` event is met, which breaks the contract with
frontend.
2026-01-21 15:29:00 +08:00
20be1dd819 feat(api): support variable reference and substitution in Email delivery
The EmailDeliveryConfig.body now support referencing variables generated
by precedent nodes.
2026-01-21 15:26:25 +08:00
32dab780ba feat(api): adjust /events resumption mechanism
Avoid drain_queue and race condition caused by drain queue.

The current approach starts a background thread and buffer in-fly events
to an intermediate queue.Queue. The queue is bound and will drop events
once it's full.
2026-01-21 14:29:26 +08:00
ef25255bfe fix(api): close connection for workflow_paused event
This only affect new connection, not connections which requests
state snapshots.
2026-01-21 13:48:50 +08:00
b529c78882 fix(api): send the node state snapshots while reestablish subscription 2026-01-21 09:51:34 +08:00
70f12ad310 fix(api): preserve the output generated before pausing 2026-01-19 16:43:01 +08:00
4d3a553ec9 Check the commit 6337a9a125 and revert engine support for node resumption flag (vibe-kanban 8057be68) 2026-01-19 16:23:35 +08:00
33dd9c8ad7 chore(api): fix lint and style issues 2026-01-19 16:22:52 +08:00
578cac35e3 chore(api): reformat code 2026-01-19 10:48:45 +08:00
b085df9425 feat(api): restore node state snapshots via /events api 2026-01-19 09:58:45 +08:00
6bf6bf6a2a feat(api): implement test form delivery & submission logic (vibe-kanban 89cd6a22)
This ensures that user can receive & submit form while using email
delivery test.
2026-01-19 09:52:30 +08:00
2db638b992 Add a configuration for controlling the redis instance / type used for streaming events between celery worker and api (vibe-kanban 08e07904)
Currently, the celery worker executing workflows / chatflows uses redis pubsub to publish events to api.
(See \_topic\_msg\_generator and \_publish\_streaming\_response)

The current implementation uses the default redis client.

For large scale deployment, we need to use a dedicated redis cluster to ensure performance.

To achieve this, you should:

1. introduce a dedicated configuration class to control

  the redis address used for pubsub. (Ideally, there should only be one configuration item such as `pubsub_redis_url`, and its default value should be the original redis confugration.)

2. Add an option to switch between pubsub and sharded pubsub. When shared pubsub is specified, the ShardedRedisBroadcastChannel should be used instead.

COmplete the task above, add some unit tests.
2026-01-19 07:40:44 +08:00
afdf2397f2 Change the is_resumption field in WorkflowStarted event into reason (vibe-kanban 19ac040e)
Reason should be an enumeration with only one member `resumption` currently.

Please update these part of events:

- Graph / Engine Event (GraphRunStartedEvent)
- Queue event (QueueWorkflowStartedEvent)
- SSE response event (WorkflowStartStreamResponse)

Besides, you should remove the `is_resumption` flag for `node_started` events; including:

- Queue Event (`QueueNodeStartedEvent`)
- SSE Event (`NodeStartStreamResponse`)
- Node event (`NodeRunStartedEvent`)

After finishing the changes above, adjust related tests.
You should run the affected tests and ensure they can pass. (You should use `uv run pytest` to run tests)
2026-01-18 21:00:25 +08:00
7bc7a8d0ab Length limit for UserAction fields (vibe-kanban e9ec1f07)
Add the following length limit to UserAction fields:

- limit the length of `id` to 20 chars.
- limit the length of title to 40 chars.

Add some unit tests to ensure the validation rules are enforced.
2026-01-16 18:18:37 +08:00
1f47ea8452 Merge the two delivery test api (vibe-kanban 7e7941e4)
The AdvancedChatDraftHumanInputDeliveryTestApi and WorkflowDraftHumanInputDeliveryTestApi are the same. Merge this two api by deleting AdvancedChatDraftHumanInputDeliveryTestApi and allowing

Chatflow to use WorkflowDraftHumanInputDeliveryTestApi.

Update tests accordingly. This project uses uv to manage dependencies.
2026-01-16 14:06:32 +08:00
68d56415d0 Rename the placeholder_values to resolved_placeholder_values in HumanInputFormApi (vibe-kanban 4b9631d6)
Update tests accordingly. Ensure relevant tests are green.
2026-01-16 13:27:35 +08:00
e099a8de47 feat(api): simplify the FormDefinition API for web app 2026-01-16 09:49:45 +08:00
80139bdfb4 test(api): adjust tests for _resolve_human_input_email_delivery_enabled 2026-01-16 09:42:39 +08:00
915de2b8dd fix(api): submission return 404 for web app api 2026-01-15 18:01:13 +08:00
73939fd645 fix(api): allow the team plan to use email delivery 2026-01-15 17:25:35 +08:00
5bf1feb93c fix(api): fix incorrect base url for form submission page 2026-01-15 16:09:18 +08:00
683407df6f fix(api): incorrect input submission url in email 2026-01-15 13:50:14 +08:00
1114806978 fix(api): allow any form to be submitted via web app api 2026-01-15 13:37:59 +08:00
c45dd66bd7 The site field returned by HumanInputFormApi is inconsistent with the API docs (vibe-kanban e0fb38c9)
```javascript

Expected structure:

```json
{
    "site": {
        "app_id": "e9823576-d836-4f2b-b46f-bd4df1d82230",
        "end_user_id": "b7aa295d-1560-4d87-a828-77b3f39b30d0",
        "enable_site": true,
        "site": {
            "title": "wf",
            "chat_color_theme": null,
            "chat_color_theme_inverted": false,
            "icon_type": "emoji",
            "icon": "\ud83e\udd16",
            "icon_background": "#FFEAD5",
            "icon_url": null,
            "description": null,
            "copyright": null,
            "privacy_policy": null,
            "custom_disclaimer": "",
            "default_language": "en-US",
            "prompt_public": false,
            "show_workflow_steps": true,
            "use_icon_as_answer_icon": false
        },
        "model_config": null,
        "plan": "basic",
        "can_replace_logo": false,
        "custom_config": null
    },
    // ... other fields
}

```

The current implementation of HumanInputFormApi returns the following structure:

```json

{
    "site": {
        "title": "hitl-chatflow",
        "chat_color_theme": null,
        "chat_color_theme_inverted": false,
        "icon_type": "emoji",
        "icon": "🤖",
        "icon_background": "#FFEAD5",
        "icon_url": null,
        "description": null,
        "copyright": null,
        "privacy_policy": null,
        "custom_disclaimer": "",
        "default_language": "en-US",
        "prompt_public": false,
        "show_workflow_steps": true,
        "use_icon_as_answer_icon": false
    },

    // ... other fields
}

```

\`\`\`
2026-01-15 12:26:51 +08:00
d87ff9e501 Ensure that only users with Pro plan can use Email Delivery in HumanInput Node (vibe-kanban ea6739cc)
For users with sandbox plan, the email delivery is not available.

The backend logic should check the plan of the current tenant while sending email. The core check logic should be abstracted in FeatureService. The `HumanInput` node configuration should not validate the presence of `EmailDelivery`.

For enterprise deployment, the email delivery is not limited.
2026-01-15 12:03:58 +08:00
e50d849913 Implement debug_mode for email delivery (vibe-kanban f32190a0)
The EmailDeliveryConfig in api/core/workflow/nodes/human\_input/entities.py has a field `debug_mode`. When this field is set to `True` in `node_data`, the test run (InvokeFrom.DEBUGGER) and the delivery test should only sent test emails to the current user, instead of sending to the specified recipients.

Please implement this logic, write correspond test cases to ensure that the logic works as expected.
2026-01-15 10:21:32 +08:00
ea90746ed7 feat(api): adjust /pause-details api, add backstage form token 2026-01-15 09:43:16 +08:00
f1b2e1cfb4 feat(api): Add app_id field to HumanInputForm model
This ensures that `HumanInputForm` could be associated to a specific
application without relying on `WorkflowRun`, providing us a smoother
migration path if we want to implement test form.
2026-01-14 16:58:17 +08:00
25cc2ab738 fix(api): missing site field in Web App Form Definition API 2026-01-14 14:25:57 +08:00
552b65e36b fix(api): ensure is_resumption is properly propagated to SSE events
While running workflow / chatflow from "Installed Apps" / "Web App"
pages, the `node_started` SSE event is manually serialized from the
pydantic model. This causes the lack of `is_resumption` flag in SSE
events.

This PR addresses the problem by adding a `is_resumption` field to
the serialized dict.
2026-01-14 10:26:57 +08:00
8e0e5d2974 feat(api): send ping while the connection is idle
To keep the connection alive and avoid being closed.
2026-01-14 10:25:13 +08:00
9c287ee0ae feat(api): adjust form submission run api
Separate `inputs` and `form_inputs` fields.
2026-01-13 11:08:31 +08:00
99937aba2e refactor(api): Unify Human Input handling logic 2026-01-13 10:39:55 +08:00
18fd308a81 fix(api): ensure display_in_ui is persisted 2026-01-13 09:30:42 +08:00
6bcd4ad740 fix(api): Ensure is_resumption for node_started event is correctly set 2026-01-13 09:25:44 +08:00
5523df6023 feat(api): adjust HumanInput single stepping endpoints 2026-01-13 08:38:38 +08:00
b3069bf154 feat(api): expose workflow_run_id in human_input extra contents 2026-01-09 00:22:59 +08:00