Repository navigation
Fix detached limit.map calls - #108
Merged
Merged
Conversation
1 task
hitoshikumagai
added a commit
to hitoshikumagai/cd14715-claude-code-classroom
that referenced
this pull request
Nov 7, 2026
…ew run Running against sindresorhus/p-limit#108 surfaced several problems: - Retired model: SDK 0.1 maps the 'sonnet' alias to a retired model ID (404). Subagents now inherit ANTHROPIC_MODEL; examples use claude-sonnet-5-5. - SDK 0.1 duplicated tool_use ids after parallel tool calls with current models (400). Upgrade @anthropic-ai/claude-agent-sdk to ^0.3.319, which requires zod v4: replace zod-to-json-schema with z.toJSONSchema (target draft-7, since the CLI rejects the 2020-12 $schema) and use the two-argument z.record. - The Agent tool (formerly Task) runs subagents in the background by default, so the orchestrator re-spawned them and polled. The prompt now requires run_in_background: false in a single message, built-in tools are limited to Agent and Skill, and GitHub MCP tools load up front. - Stop on non-retryable API errors instead of looping to maxTurns on every retry; withRetry skips errors marked retryable: false. - Fetch files by head SHA (head branch may be on a fork) and disallow the GitHub MCP server's write tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
limit.mapuse the limiter it belongs to instead of its call-time receivermapcalls sharing the limiter's configured concurrency with direct tasksProblem
LimitFunction.mapis exposed as a callable function property, but its implementation invokes the limiter through dynamicthis. A valid detached call such asconst {map} = limittherefore rejects withTypeError: this is not a function.Fix
Use the closed-over
generatorfunction when scheduling mapped items. This preserves the existing concurrency, ordering, iterable, and index behavior without requiring a bound receiver.The regression test combines a direct limiter call with a detached
mapcall and verifies their shared maximum concurrency remains at the configured limit.Testing
npm exec ava -- --match='map works when detached from the limit'npm exec avanpm exec tsdnpm exec xo -- index.js test.jsThe aggregate
npm testcommand was also attempted. On this Windows checkout, XO reports its existing TypeScript project-service lookup error forindex.d.tsandindex.test-d.ts; the same error occurs on the untouched base. The changed JavaScript files pass XO.