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

Add logging to confirm that stdout isn't empty when triggering on cell execution #333

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
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
20 changes: 20 additions & 0 deletions app/pkg/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,26 @@ func (a *Agent) StreamGenerate(ctx context.Context, stream *connect.BidiStream[v
doc.Blocks[selectedCell] = block
}

if req.Trigger == v1alpha1.StreamGenerateRequest_CELL_EXECUTE {
stdOutLength := 0
for _, o := range doc.Blocks[selectedCell].Outputs {
for _, item := range o.Items {
if item.Mime == docs.VSCodeNotebookStdOutMimeType {
if item.GetTextData() != "" {
stdOutLength = len(item.GetTextData())
break
}
}
}
}

if stdOutLength == 0 {
// N.B.This is to help debug https://github.com/jlewi/foyle/issues/309
// This will create false positives in the event the command produces no output
log.Info("Empty stdout", logs.ZapProto("request", req), "doc", doc, "selectedCell", selectedCell)
}
}

if req.GetContextId() != state.getContextID() {
return status.Errorf(codes.InvalidArgument, "ContextId doesn't match current value; expected %s; got %s", state.getContextID(), req.GetContextId())
}
Expand Down
2 changes: 1 addition & 1 deletion app/pkg/docs/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ const (
// https://github.com/jlewi/foyle/issues/286
StatefulRunmeOutputItemsMimeType = "stateful.runme/output-items"
StatefulRunmeTerminalMimeType = "stateful.runme/terminal"
VSCodeNotebookStdOutMimeType = "application/vnd.code.notebook.stdout "
VSCodeNotebookStdOutMimeType = "application/vnd.code.notebook.stdout"
)
6 changes: 6 additions & 0 deletions developer_guides/runme.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ Now we can install the extension using the vscode binary
/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --force --install-extension ~/git_vscode-runme/runme-extension.vsix
```

```bash {"id":"01JBQ3ZJSS2FXAH4E0CK6SH841"}
cd ~/git_vscode-runme
npm run build
npm run bundle
```

```bash {"id":"01JAH5BVWFNHDGGECF7PRE2EE9","interactive":"false"}
# To check the installed version of the RunMe extension in Visual Studio Code after installation, use the following command:
BINARY="/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"
Expand Down
Loading