Skip to content

fix(ai): harden tool updates and context recovery - #317

Open
Serta莽 脰zercan (sozercan) wants to merge 7 commits into
mainfrom
fix/ai-tool-context-recovery
Open

Serta莽 脰zercan (sozercan) wants to merge 7 commits into
mainfrom
fix/ai-tool-context-recovery

Conversation

@sozercan

Copy link
Copy Markdown
Member

Summary

Stacked salvage from #280. Base: #311 (fix/worker-delivery-cancellation).

  • Recover from provider context-limit errors using the complete serialized request size, dropping historical message/tool-result blocks atomically and only truncating the current task when required.
  • Correct nested model updates while preserving omitted fields and legacy model-string compatibility.
  • Bound update_plan network stalls and make wait_for_tasks tolerate transient reads without retrying authorization or validation failures.

Scope

This PR is limited to AI context recovery and built-in tool reliability. It does not change worker result/artifact delivery, API schemas, or Task finalization semantics.

Verification

  • go test ./internal/llm ./internal/tools ./workers/ai -count=1
  • make lint-fix && make test
  • Full required CI

After #311 merges, this PR should be retargeted to main.

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c3d8bce2f1

鈩癸笍 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 (@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 (@codex) address that feedback".

Comment thread internal/tools/update_agent.go
Comment thread internal/tools/wait_for_tasks.go
Comment thread internal/tools/wait_for_tasks.go Outdated
Comment thread internal/llm/truncate.go Outdated
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6266e27622

鈩癸笍 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 (@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 (@codex) address that feedback".

Comment thread internal/llm/truncate.go
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b02d953c3f

鈩癸笍 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 (@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 (@codex) address that feedback".

Comment thread internal/tools/update_agent.go Outdated
Comment thread internal/llm/truncate.go
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Comment thread internal/llm/truncate.go
}

withNote := func(content string) ([]Message, CompletionRequestSize, error) {
messages := make([]Message, 0, len(keptMessages)+1)
Base automatically changed from fix/worker-delivery-cancellation to main September 13, 2026 02:59
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.

2 participants