Skip to content

fix: unblock codex harness turns and hot-swap models mid-session#1

Merged
OmGuptaIND merged 2 commits intomainfrom
OmGuptaIND/fix-harness-loop
Apr 20, 2026
Merged

fix: unblock codex harness turns and hot-swap models mid-session#1
OmGuptaIND merged 2 commits intomainfrom
OmGuptaIND/fix-harness-loop

Conversation

@OmGuptaIND
Copy link
Copy Markdown
Contributor

Summary

  • Fix turn/start: Invalid request: missing field 'type' (code -32600) that was aborting every codex-harness turn at 0 chars — readOnlyAccess: {} was missing the type discriminator required by the ReadOnlyAccess union; now { type: 'fullAccess' }.
  • Add switchModel(provider, model) to both HarnessSession (claude) and CodexHarnessSession so picking a different model mid-conversation actually takes effect on the next turn. Same-provider only — cross-provider switches keep the old session and log a clear reason.
  • Log per-session outcomes in handleProviderSetDefault with apiSwitched / harnessSwitched / harnessSkipped counts so model-picker changes are visible in server logs.

Test plan

  • Start a codex harness session on gpt-5.4, send a message, confirm response streams (regression test for the original -32600 bug).
  • Mid-conversation, switch model to a different codex model; next turn should use the new model. Check server log for Switched harness session model (applies to next turn).
  • Mid-conversation, switch provider from codex → anton; existing session should keep its original model and log cross-provider switch requires a new session; a new session picks up the new provider/model.
  • API (Pi SDK) sessions continue to hot-swap across providers as before.

🤖 Generated with Claude Code

OmGuptaIND and others added 2 commits April 20, 2026 16:40
`turn/start` was being rejected with `missing field 'type'` because
`readOnlyAccess: {}` doesn't match the `ReadOnlyAccess` union (requires
`type: 'fullAccess' | 'restricted'`). Set it to `fullAccess` so workspace
writes keep unrestricted reads outside the workspace.

Harness sessions previously skipped the default-model switch entirely,
so picking a new model mid-conversation silently kept routing to the
original one. Added `switchModel` to both `HarnessSession` and
`CodexHarnessSession` — same-provider switches mutate `this.model` and
take effect on the next turn (codex via `turn/start.model` override,
claude via `--model` arg at spawn). Cross-provider switches stay on the
old session and log an explicit reason.

Also surfaced per-session outcomes in logs with `apiSwitched`,
`harnessSwitched`, and `harnessSkipped` counts so the effect of a
provider change is visible.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Session IDs are plain `sess_xxx` and carry no project info, so the
legacy regex in `deleteSession` never matched and
`~/.anton/projects/{projectId}/conversations/{id}/` was left on disk.
`handleProjectSessionsList` reads that folder directly, so destroyed
sessions reappeared on reload.

`deleteSession` now takes an optional projectId (already passed from
`handleSessionDestroy`) and falls back to scanning the projects root
when no hint is available, so the on-disk folder is removed regardless
of session ID shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@OmGuptaIND OmGuptaIND merged commit 9f92aef into main Apr 20, 2026
OmGuptaIND added a commit that referenced this pull request Apr 20, 2026
### Fixes
- unblock codex harness turns and hot-swap models mid-session (#1)
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.

1 participant