Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ private void updateStatus(TaskState taskState) {
updateStatus(taskState, null, taskState.isFinal());
}

private void updateStatus(TaskState taskState, Message message) {
public void updateStatus(TaskState taskState, Message message) {
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Making this method public is a good step towards a more flexible API. However, it creates a slight inconsistency because other methods like requiresInput and requiresAuth allow overriding the isFinal flag, a capability this new generic method lacks. This could be confusing for users of this class.

To improve API consistency, consider also making the three-argument updateStatus method (currently at line 39) public. This would provide a fully flexible generic entry point for all status updates.

A more consistent API design could look like this:

// Convenience overload, as it is now
public void updateStatus(TaskState taskState, Message message) {
    updateStatus(taskState, message, taskState.isFinal());
}

// Generic method with full flexibility, made public
public void updateStatus(TaskState state, Message message, boolean isFinal) {
    // ... current implementation
}

This would make the TaskUpdater API more predictable and robust.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated

updateStatus(taskState, message, taskState.isFinal());
}

private void updateStatus(TaskState state, Message message, boolean isFinal) {
public void updateStatus(TaskState state, Message message, boolean isFinal) {
synchronized (stateLock) {
// Check if we're already in a terminal state
if (terminalStateReached.get()) {
Expand All @@ -62,6 +62,10 @@ public String getContextId() {
return this.contextId;
}

public String getTaskId() {
return this.taskId;
}

public void addArtifact(List<Part<?>> parts) {
addArtifact(parts, null, null, null);
}
Expand Down