Skip to content
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

Fix: Add error status handling for ingestion and sync source #283

Merged
merged 5 commits into from
Oct 24, 2024

Conversation

StrongMonkey
Copy link
Contributor

@StrongMonkey StrongMonkey commented Oct 23, 2024

This PR addes the following things

  1. It add knowledgeSetStatus to agent and propogate error from ingestion run.
  2. Fixed a bug where ingestion is not running when it errors
  3. UI components to render error status

#186

pkg/api/handlers/agent.go Outdated Show resolved Hide resolved
pkg/controller/handlers/agents/agents.go Outdated Show resolved Hide resolved
Comment on lines 263 to 278
// Fetch ingestion error from run.status in go routine so that we don't block
runName := ws.Status.IngestionRunName
go func() {
for {
stop, err := updateIngestionError(req, ws, runName)
if err != nil {
logger.Errorf("failed to update ingestion error: %s", err)
break
}

if stop {
break
}
time.Sleep(time.Second * 5)
}
}()
Copy link
Contributor

Choose a reason for hiding this comment

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

The above call to compileFileStatuses will only return once the run is complete (either success or failure). This would mean that this coroutine would only run once.

Can it be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem here is that even when run is finished, the run.status.error is not propagated from other controller(run controller) here so it needs to wait for a bit for the error to be propagated.

Copy link
Contributor

@thedadams thedadams Oct 23, 2024

Choose a reason for hiding this comment

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

If that's the case, then I think this should be a controller handler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we are wiping out ws.Status.IngestionRunName in the end, so other controller won't have information about the latest run. So it might be easy to just add logic to to retrieve the error.

Copy link
Contributor

Choose a reason for hiding this comment

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

I pushed a commit with how I would understand this to work if we didn't use a goroutine. Let me know what you think about it. If it doesn't work like you expect, then we can just drop the commit I added.

pkg/controller/handlers/knowledge/knowledge.go Outdated Show resolved Hide resolved
pkg/controller/handlers/knowledge/knowledge.go Outdated Show resolved Hide resolved
pkg/controller/handlers/threads/threads.go Show resolved Hide resolved
@@ -249,63 +249,44 @@ func (a *Handler) UpdateFileStatus(req router.Request, _ router.Response) error
return err
}

if run.Status.State.IsTerminal() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@thedadams There is a chance that when run is not in terminal state and we are not immediately setting ws.Status.IngestionRunName = '', the controller will reprocess the logs from the run events, which could be a lot of computes.

So I think the best way to address this without a goroutine is to add a new field lastIngestionRunName to keep track it the run and update error based on that.

@StrongMonkey StrongMonkey merged commit c5420b5 into otto8-ai:main Oct 24, 2024
1 check passed
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