Skip to content

fix: bump pctx_code_mode to 0.3.0 for iterator type checking fix#7892

Merged
jh-block merged 3 commits intoblock:mainfrom
spitfire55:fix/bump-pctx-code-mode-for-iterator-fix
Mar 16, 2026
Merged

fix: bump pctx_code_mode to 0.3.0 for iterator type checking fix#7892
jh-block merged 3 commits intoblock:mainfrom
spitfire55:fix/bump-pctx-code-mode-for-iterator-fix

Conversation

@spitfire55
Copy link
Contributor

Summary

  • Bumps pctx_code_mode from ^0.2.3 to ^0.3.0
  • Fixes false-positive TS2488 errors that cause execute tool calls with for...of loops to fail

Problem

The execute tool uses pctx's TypeScript type checker before running code. With pctx_code_mode 0.2.3 (which depends on pctx_type_check_runtime 0.1.2), the type checker uses a minimal lib.d.ts that doesn't include ES2015 iterable definitions (lib.es2015.iterable.d.ts).

This means any code using for...of on an array fails type checking with:

TS2488: Type '{}' must have a '[Symbol.iterator]()' method that returns an iterator.

Even though arrays are perfectly iterable at runtime. When this happens, the execute tool aborts before execution, and the model has to fall back to making individual tool calls instead of batched operations.

Example of valid code that fails:

const files = ['a.go', 'b.go', 'c.go'];
for (const f of files) {  // TS2488 error here
    await Developer.shell({ command: `cat ${f}` });
}

Fix

pctx_code_mode 0.3.0 depends on pctx_type_check_runtime 0.1.3, which includes full ES2020+ lib files (including lib.es2015.iterable.d.ts). This was fixed upstream in portofcontext/pctx@db67183 ("include ts lib deps as part of type checking").

Test plan

  • Verify execute tool calls with for...of loops no longer fail type checking
  • Verify existing execute tool functionality is unaffected

🤖 Generated with Claude Code

pctx_code_mode 0.2.3 depends on pctx_type_check_runtime 0.1.2, which
uses a minimal lib.d.ts without ES2015 iterable definitions. This
causes the TypeScript type checker to reject valid `for...of` loops
on arrays with TS2488 ("Type '{}' must have a '[Symbol.iterator]()'
method"), even though arrays are iterable at runtime.

pctx_code_mode 0.3.0 depends on pctx_type_check_runtime 0.1.3, which
includes full ES2020+ lib files (including lib.es2015.iterable.d.ts),
fixing the false-positive type errors.

This was causing execute tool calls with `for...of` loops to fail type
checking and abort before execution, forcing the model to fall back to
individual tool calls instead of batched operations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Clyde <clyde@Clydes-Mac-Studio.local>
Signed-off-by: Dale Lakes <6843636+spitfire55@users.noreply.github.com>
@spitfire55 spitfire55 force-pushed the fix/bump-pctx-code-mode-for-iterator-fix branch from 03e04e2 to b40cbe5 Compare March 14, 2026 15:37
Copy link

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

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: 03e04e2153

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

tree-sitter-typescript = { workspace = true }
which = { workspace = true }
pctx_code_mode = { version = "^0.2.3", optional = true }
pctx_code_mode = { version = "^0.3.0", optional = true }

Choose a reason for hiding this comment

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

P2 Badge Regenerate Cargo.lock after bumping pctx_code_mode

This manifest change alone does not update the repository’s resolved dependency set: in this revision, Cargo.lock still pins pctx_code_mode to 0.2.3 (and pctx_type_check_runtime to 0.1.2), so the intended type-checking fix is not actually captured in committed sources that rely on the lockfile; in lockfile-driven/frozen build contexts, this either keeps the old behavior or fails because the lock is stale.

Useful? React with 👍 / 👎.

spitfire55 and others added 2 commits March 14, 2026 16:06
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Dale Lakes <6843636+spitfire55@users.noreply.github.com>
pctx_code_mode 0.3.0 restructured its public API:
- CallbackRegistry -> registry::PctxRegistry
- CallbackFn -> registry::CallbackFn
- registry.add() -> registry.add_callback()
- code_mode.execute() -> code_mode.execute_typescript() with ToolDisclosure
- CallbackConfig.namespace: String -> Option<String>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Dale Lakes <6843636+spitfire55@users.noreply.github.com>
@jh-block jh-block added this pull request to the merge queue Mar 16, 2026
Merged via the queue into block:main with commit 5df2995 Mar 16, 2026
21 checks passed
wpfleger96 added a commit that referenced this pull request Mar 16, 2026
…oken-retry

* origin/main: (21 commits)
  Remove java/.ai-usage-marker directory (#7925)
  test(acp): add terminal delegation fixtures and fix shell singleton (#7923)
  fix: bump pctx_code_mode to 0.3.0 for iterator type checking fix (#7892)
  feat: persist GooseMode per-session via session DB (#7854)
  feat(otel): propagate session.id to spans and log records (#7490)
  fix(test): add env_lock to is_openai_reasoning_model tests (#7917)
  fix(acp): pass session_id when loading extensions so skills are discovered (#7868)
  updated canonical models (#7920)
  feat(autovisualiser): Migrate the autovisualiser extension to MCP Apps  (#7852)
  fix: add tool_choice and parallel_tool_calls to chatgpt_codex provider (#7867)
  fix: tool confirmation handling for multiple requests (#7856)
  Remove dead OllamaSetup onboarding flow (#7861)
  fix: resolve tokio::sync::Mutex deadlock in recipe retry path (#7832)
  Upgrade Electron 40.6.0 → 41.0.0 (#7851)
  Only show up to 50 lines of source code (#7578)
  fix: stop writing without error when hitting broken pipe for goose session list (#7858)
  feat(acp): add session/set_mode handler (#7801)
  Keep messages in sync (#7850)
  More acp tools (#7843)
  fix: skip upgrade-insecure-requests CSP for external HTTP backends (#7714)
  ...
wpfleger96 added a commit that referenced this pull request Mar 16, 2026
* origin/main: (72 commits)
  No Check do Check (#7942)
  Log 500 errors and also show error for direct download (#7936)
  fix: retry on authentication failure with credential refresh (#7812)
  Remove java/.ai-usage-marker directory (#7925)
  test(acp): add terminal delegation fixtures and fix shell singleton (#7923)
  fix: bump pctx_code_mode to 0.3.0 for iterator type checking fix (#7892)
  feat: persist GooseMode per-session via session DB (#7854)
  feat(otel): propagate session.id to spans and log records (#7490)
  fix(test): add env_lock to is_openai_reasoning_model tests (#7917)
  fix(acp): pass session_id when loading extensions so skills are discovered (#7868)
  updated canonical models (#7920)
  feat(autovisualiser): Migrate the autovisualiser extension to MCP Apps  (#7852)
  fix: add tool_choice and parallel_tool_calls to chatgpt_codex provider (#7867)
  fix: tool confirmation handling for multiple requests (#7856)
  Remove dead OllamaSetup onboarding flow (#7861)
  fix: resolve tokio::sync::Mutex deadlock in recipe retry path (#7832)
  Upgrade Electron 40.6.0 → 41.0.0 (#7851)
  Only show up to 50 lines of source code (#7578)
  fix: stop writing without error when hitting broken pipe for goose session list (#7858)
  feat(acp): add session/set_mode handler (#7801)
  ...
lifeizhou-ap added a commit that referenced this pull request Mar 17, 2026
* main:
  Add DCO git commit command to AGENTS.md (#7945)
  fix(claude-code): remove incorrect agent_visible filter on user message (#7931)
  No Check do Check (#7942)
  Log 500 errors and also show error for direct download (#7936)
  fix: retry on authentication failure with credential refresh (#7812)
  Remove java/.ai-usage-marker directory (#7925)
  test(acp): add terminal delegation fixtures and fix shell singleton (#7923)
  fix: bump pctx_code_mode to 0.3.0 for iterator type checking fix (#7892)
  feat: persist GooseMode per-session via session DB (#7854)
  feat(otel): propagate session.id to spans and log records (#7490)
  fix(test): add env_lock to is_openai_reasoning_model tests (#7917)
  fix(acp): pass session_id when loading extensions so skills are discovered (#7868)
jh-block added a commit that referenced this pull request Mar 17, 2026
* origin/main:
  feat: adversarial agent for preventing leaking of info and more  (#7948)
  Update contributing.md (#7927)
  docs: add credit balance monitoring section (#7952)
  docs: add Cerebras provider to supported providers list (#7953)
  docs: add TUI client documentation to ACP clients guide (#7950)
  fix: removed double dash in pnpm command (#7951)
  docs: polish ACP docs (#7946)
  claude adaptive thinking (#7944)
  feat: new onboarding flow (#7266)
  Add DCO git commit command to AGENTS.md (#7945)
  fix(claude-code): remove incorrect agent_visible filter on user message (#7931)
  No Check do Check (#7942)
  Log 500 errors and also show error for direct download (#7936)
  fix: retry on authentication failure with credential refresh (#7812)
  Remove java/.ai-usage-marker directory (#7925)
  test(acp): add terminal delegation fixtures and fix shell singleton (#7923)
  fix: bump pctx_code_mode to 0.3.0 for iterator type checking fix (#7892)
  feat: persist GooseMode per-session via session DB (#7854)
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