Skip to content

fix: refresh model context and preserve live session state - #283

Merged
jkyberneees merged 1 commit into
mainfrom
fix/functional-pagination-and-model-context
Sep 30, 2026
Merged

jkyberneees merged 1 commit into
mainfrom
fix/functional-pagination-and-model-context

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Background output pagination could stop advancing on multibyte characters or binary bytes. Model switches kept the previous model's context window, and live REST/WebSocket records lost session/model information until a turn completed.

Fix five reproduced functional bugs:

  • Advance output cursors across Unicode and invalid UTF-8, returning a complete first rune when a byte limit is too small.
  • Refresh automatic context limits on model switches while preserving explicit overrides, and trim history before requesting a smaller model.
  • Publish REST run session IDs as soon as the session is established, including while the provider is blocked.
  • Keep WebSocket connections bound to the effective session throughout new and resumed prompts, so busy/wake routing remains accurate.
  • Initialize connection model metadata and update it under the connection lock when switching models.

Adversarial sub-agent review caught two additional edge cases: repeated same-model switches must preserve tokenizer calibration, and blocking context discovery must keep an attached session busy. Both are fixed and covered by permanent regressions; final re-review found no remaining actionable issues.

Validation: race tests for the root, cmd/odek, internal/loop, and internal/bgproc packages (root with an isolated test home); targeted regressions; golangci-lint v2.14.0; go vet; govulncheck.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
odek ef690ed Commit Preview URL

Branch Preview URL
Sep 30 2026, 07:52 AM

@jkyberneees
jkyberneees merged commit db6ff7a into main Sep 30, 2026
10 checks 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.

1 participant