-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Add task processing streaming support #60500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7870537
feat(task-streaming): allow the Php providers to set intermediate res…
julien-nc 74d078e
fix(task-streaming): and test sending data via notify_push
julien-nc e4bea82
feat(task-streaming): add an endpoint to set a task intermediate output
julien-nc d65252b
fix(task-streaming): make the notify_push message shorter
julien-nc a6e6d92
feat(task-streaming): do not update the task in DB when setting inter…
julien-nc ddf9142
feat(task-streaming): add preferStreaming boolean attribute to taskpr…
julien-nc 207f347
feat(task-streaming): add new provider interface
julien-nc b04de05
fix(task-streaming): fix psalm issues, run cs:fix, gen openapi specs
julien-nc 8ee0281
feat(task-streaming): rename ISynchronousOptionsProvider to ISynchron…
julien-nc 4da89e9
feat(task-streaming): send a notify_push message whenever a task stat…
julien-nc c7d8369
feat(task-streaming): adjust notify push messages, add sort of a name…
julien-nc 3f4eae2
feat(task-streaming): only send notify_push status updates after we a…
julien-nc 0bd6072
feat(task-streaming): fix tests
julien-nc 76709d7
feat(task-streaming): address review comments
julien-nc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
|
|
||
| namespace OC\Core\Migrations; | ||
|
|
||
| use Closure; | ||
| use OCP\DB\ISchemaWrapper; | ||
| use OCP\DB\Types; | ||
| use OCP\Migration\Attributes\AddColumn; | ||
| use OCP\Migration\Attributes\ColumnType; | ||
| use OCP\Migration\IOutput; | ||
| use OCP\Migration\SimpleMigrationStep; | ||
|
|
||
| /** | ||
| * | ||
| */ | ||
| #[AddColumn(table: 'taskprocessing_tasks', name: 'prefer_streaming', type: ColumnType::SMALLINT)] | ||
| class Version35000Date20260527162338 extends SimpleMigrationStep { | ||
|
|
||
| /** | ||
| * @param IOutput $output | ||
| * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` | ||
| * @param array $options | ||
| * @return null|ISchemaWrapper | ||
| */ | ||
| #[\Override] | ||
| public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { | ||
| /** @var ISchemaWrapper $schema */ | ||
| $schema = $schemaClosure(); | ||
|
|
||
| if ($schema->hasTable('taskprocessing_tasks')) { | ||
| $table = $schema->getTable('taskprocessing_tasks'); | ||
| if (!$table->hasColumn('prefer_streaming')) { | ||
| $table->addColumn('prefer_streaming', Types::SMALLINT, [ | ||
| 'notnull' => true, | ||
| 'default' => 1, | ||
| 'unsigned' => true, | ||
| ]); | ||
| return $schema; | ||
| } | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt of making it
0by default since streaming can be seen as a higher priority task than the normal requests so only the things that need the streamed response should manually activate it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In most of the cases, we want streaming. We want to disable it only in background tasks or sub tasks. I think it's fine to keep it enabled by default. Also, the providers still return the exact same result at the end of a streaming task. Even if streaming is enabled when we don't want it, nothing gets broken. The opposite is not true, if we miss a spot where we want streaming, we just don't get a streamed output...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe so but this way even calls not wanting the streamed output get it, since it's the default and the only task processing interface now.
and the streaming result makes sense most for the assistant where it can always pass stream = true anyway.
but maybe we need real world use of the api to really know the impact.