Repository navigation
Add Go console runtime mirroring core agent loop - #371
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func (rt *Runtime) executePlanIfReady(ctx context.Context) (bool, error) { | ||
| step, ok := rt.planManager.Ready() | ||
| if !ok { | ||
| return false, nil | ||
| } | ||
|
|
||
| if !rt.options.AutoApprove && !rt.options.NoHuman { | ||
| fmt.Fprintf(rt.writer, "\nPlan step %s is ready:\n %s\n Command: %s\nExecute? [y/N]: ", step.ID, step.Title, step.Command.Run) | ||
| answer, err := rt.reader.ReadString('\n') | ||
| if err != nil { | ||
| if errors.Is(err, io.EOF) { | ||
| return false, err | ||
| } | ||
| return false, fmt.Errorf("runtime: read approval: %w", err) | ||
| } | ||
| answer = strings.TrimSpace(strings.ToLower(answer)) | ||
| if answer != "y" && answer != "yes" { | ||
| fmt.Fprintf(rt.writer, "Skipped plan step %s.\n", step.ID) | ||
| return true, nil |
There was a problem hiding this comment.
Update plan state when user rejects a step
When auto-approve is disabled, answering anything other than y/yes at the approval prompt just prints Skipped plan step <id> and returns (executePlanIfReady exits at the early return on rejection) without marking the step as abandoned or notifying the assistant. The step remains pending in the manager, so the outer loop immediately calls executePlanIfReady again and displays the same approval prompt before the user can type other commands. After declining once, the runtime becomes stuck prompting forever unless the process is killed. Consider updating the step status and/or querying the assistant so that the loop can progress after a rejection.
Useful? React with 👍 / 👎.
Summary
golangworkspace with a console runtime that mirrors the TypeScript agent loopTesting
https://chatgpt.com/codex/tasks/task_e_68fbcf52f9a08328b1652ee0a2732790