Address review feedback: fix event handler leak, error handling, model alignment

- Move session.On handler outside loop to prevent handler accumulation (C#)
- Use TrySetResult instead of SetResult to avoid duplicate-set exceptions (C#)
- Wrap CreateSessionAsync in broader try/finally so client always stops (C#)
- Fix PersistentRalphLoop to use maxIterations parameter instead of hardcoded 10
- Align model name to gpt-5.1-codex-mini across all doc snippets
- Fix completion promise DONE -> COMPLETE in usage snippet
- Replace Claude references with generic model terminology
This commit is contained in:
Anthony Shaw
2026-02-11 06:35:14 -08:00
parent bb9f63a899
commit ab82accc08
3 changed files with 119 additions and 88 deletions

View File

@@ -49,7 +49,7 @@ class RalphLoop {
async run(initialPrompt: string): Promise<string> {
await this.client.start();
const session = await this.client.createSession({ model: "gpt-5" });
const session = await this.client.createSession({ model: "gpt-5.1-codex-mini" });
try {
while (this.iteration < this.maxIterations) {
@@ -115,7 +115,7 @@ class PersistentRalphLoop {
async run(initialPrompt: string): Promise<string> {
await fs.mkdir(this.workDir, { recursive: true });
await this.client.start();
const session = await this.client.createSession({ model: "gpt-5" });
const session = await this.client.createSession({ model: "gpt-5.1-codex-mini" });
try {
// Store initial prompt