Skip to content

feat: Add simpler API for creating external tasks#570

Merged
markstory merged 3 commits intomainfrom
feat-external-task
Mar 11, 2026
Merged

feat: Add simpler API for creating external tasks#570
markstory merged 3 commits intomainfrom
feat-external-task

Conversation

@markstory
Copy link
Member

While it was possible to create external tasks by creating a standalone registry, and using it to define tasks, these changes make creating external namespaces and tasks more ergonomic and provide conventions for routing tasks between applications.

Refs STREAM-611

While it was possible to create external tasks by creating a standalone
registry, and using it to define tasks, these changes make creating
external namespaces and tasks more ergonomic and provide conventions for
routing tasks between applications.

Refs STREAM-611
@markstory markstory requested a review from a team as a code owner March 10, 2026 20:06
@linear-code
Copy link

linear-code bot commented Mar 10, 2026

Copy link
Member

@evanh evanh left a comment

Choose a reason for hiding this comment

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

What is the scenario where an application would want to submit tasks for another application?

@markstory
Copy link
Member Author

What is the scenario where an application would want to submit tasks for another application?

The upcoming scenario is from sentry -> launchpad. The sentry API receives uploads from customer build tooling. Sentry does authentication and request validation and then will spawn a task in launchpad. This will replace the kafka consumer in launchpad.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

"""
key = f"{application}:{name}"
if key in self._external_namespaces:
raise ValueError(f"External task namespace with name {name} already exists.")
Copy link

Choose a reason for hiding this comment

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

Duplicate error message omits application context

Low Severity

The duplicate-check in create_external_namespace uses the composite key f"{application}:{name}" but the error message only includes {name}, not {application}. This makes the error misleading — it implies the collision is on the name alone, when it's actually on the application:name pair. The sibling method get_external correctly includes both application and name in its error message.

Fix in Cursor Fix in Web

self._registered_tasks[name] = task
return task

return wrapped
Copy link

Choose a reason for hiding this comment

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

Duplicated register logic across namespace classes

Low Severity

ExternalNamespace.register is a near-identical copy of TaskNamespace.register — the only difference is instantiating ExternalTask instead of Task. The retry-handling logic, default-resolution, and task-storage code are fully duplicated, meaning any future bug fix or behavior change needs to be applied in both places.

Additional Locations (1)
Fix in Cursor Fix in Web

@markstory markstory merged commit 17d6cb5 into main Mar 11, 2026
23 checks passed
@markstory markstory deleted the feat-external-task branch March 11, 2026 19:09
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