Skip to content

Conversation

@cte
Copy link
Collaborator

@cte cte commented Jul 31, 2025

No description provided.

Copy link
Contributor

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! I've reviewed the TaskBridge implementation and found several issues that need attention. The core functionality looks solid, but there are some critical error handling and concurrency issues that should be addressed.


this.reconnectTimeout = setTimeout(() => {
this.reconnectTimeout = null
this.initialize()
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing error handling here could lead to unhandled promise rejections. Consider wrapping this call in a try-catch block and implementing proper error recovery or logging.

}, this.config.reconnectDelay)
}

private setupTaskEventListeners(task: Task) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Potential memory leak: if this method fails partway through setting up event listeners, some listeners may remain attached without being tracked in taskEventHandlers. Consider implementing cleanup logic or using a transaction-like approach.

this.config = { url, namespace, reconnectOnError, maxReconnectAttempts, reconnectDelay }
}

public static getInstance(config?: TaskBridgeConfig) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Race condition: multiple concurrent calls to getInstance() could create multiple instances if called before the first instance is fully constructed. Consider using a lock or making the constructor async to prevent this.

console.log(`Received task_event event for task: ${taskId}`, message.payload)
break
}
} catch (error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this error handling intentional? Message parsing errors are only logged to console but don't trigger any recovery mechanism. Should this be more robust for production use?

await this.subscriber.unsubscribe(this.serverChannel(taskId))
}

public async publish(taskId: string, type: TaskBridgeMessageType, payload: TaskBridgeMessagePayload) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The connection check here only validates isConnected flag but doesn't verify if the Redis clients are actually ready to publish. Consider checking client.status === 'ready' as well.

export {
type TaskBridgeConfig,
type TaskBridgeMessage,
type QueuedMessage,
Copy link
Contributor

Choose a reason for hiding this comment

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

The QueuedMessage interface is exported but doesn't seem to be used in the main service implementation. Is this intended for future use or should it be documented?


// TODO: Figure out when to enable task bridge.
// eslint-disable-next-line no-constant-condition
if (true) {
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO comment with hard-coded true condition - is there a plan for when this should be conditionally enabled? This might be worth addressing before merging.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 31, 2025
@cte cte closed this Jul 31, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 31, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 31, 2025
@cte cte deleted the cte/task-bridge branch July 31, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants