Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[deepseek] A native max_tokens stop is rejected before classification, so the Turn fails instead of reporting length

Open Beginner friendly
#524 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
ai, backend

Research direction

The admission filter is in packages/worker-shim/src/adapters/deepseek.ts:1746-1753; add max_tokens to the allowed stop reasons there. The classifier at deepseek.ts:241-242 already maps it to length. Add a regression test in deepseek.test.ts sending a max_tokens prompt response and assert Turn status length and successful close. Done when the Turn settles as length and the new test passes.

Written by the indexing model from the issue text.

Description

bug doc-audit

Found by the independent documentation audit (DeepSeek Worker Adapter specification, on branch audit/independent-docs-20261023).

  • Spec clause: docs/specs/20260930-deepseek_worker_adapter.md:104@547887980b6fd3ef730ecc669d39a3092f731408, section "Native Output Mapping": "max_tokens | Proved output/context limit carried as length, rather than error; never completed success."
  • Decision: docs/decisions/20261009-truthful_native_stop_classification.md requires a proved native output or context limit to stay length.
  • Code:
    • packages/worker-shim/src/adapters/deepseek.ts:241-242@547887980 classifies the value: if (input.stopReason === 'max_tokens') return { assistantText: null, status: 'length', stopReason: 'max_tokens' };
    • packages/worker-shim/src/adapters/deepseek.ts:1746-1753@547887980 runs first on the prompt response and rejects every stop reason outside ['end_turn', 'cancelled', ...FAILED_STOP_REASONS], then calls this.poisonNativeEvidence(this.turn).
    • packages/worker-shim/src/adapters/deepseek.ts:69@547887980: FAILED_STOP_REASONS = new Set(['max_turn_requests', 'refusal']), so max_tokens is not admitted.
    • poisonNativeEvidence (deepseek.ts:1649-1661) clears the close proof, sets unknownIdentity, and marks the Turn terminal-poisoned.
  • Upstream: the pinned @deepseek-ai/[email protected] emits this value (lib/index.js:542, case "max-tokens": return "max_tokens";).
  • Tests: packages/worker-shim/src/adapters/deepseek.test.ts:196 covers only the pure classifier. No test sends a real max_tokens prompt response through the admission path.

Observed versus required

Required: a native max_tokens terminal settles the Turn as length. Observed: the admission filter treats it as invalid native evidence, so the Turn fails, the binding loses its identity proof, and close cannot succeed. The length branch of the classifier is unreachable in production.

Adjudication

The code differs from the current accepted specification and decision. Classification: implementation defect.

Repair direction

Admit max_tokens in the prompt-response admission set so that the existing classifier maps it to length. Add a regression that sends a max_tokens prompt response through the resident adapter and checks the Turn status and a successful close.

Severity hint

Wrong terminal classification and a fenced binding on a normal model limit. Not a blocking candidate: no retained format, credential, or authorization effect.

Dominant language
TypeScript
Stars
0
Forks
1
Avg merge
3h 54m
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lingkaix/openkit

All issues in lingkaix/openkit

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.