Skip to content

[codex] harden DeepSeek API format, context, and token budget#3025

Closed
j169476 wants to merge 1 commit into
ultraworkers:mainfrom
j169476:codex/harden-context-token-privacy
Closed

[codex] harden DeepSeek API format, context, and token budget#3025
j169476 wants to merge 1 commit into
ultraworkers:mainfrom
j169476:codex/harden-context-token-privacy

Conversation

@j169476
Copy link
Copy Markdown

@j169476 j169476 commented May 13, 2026

Summary

  • Adapt OpenAI-compatible DeepSeek V4 API formatting: preserve reasoning_content, keep explicit empty reasoning_content values, serialize assistant tool-call content as an empty string where DeepSeek requires it, and omit tool_choice for DeepSeek V4 tool calls.
  • Preserve DeepSeek reasoning_content from streaming and non-streaming responses so thinking blocks remain available before tool calls/text.
  • Honor configured noninteractive models such as openai/deepseek-v4-pro when no explicit --model flag is supplied.
  • Run runtime session compaction before outbound model requests, so oversized context is reduced before the provider call rather than only after a completed turn.
  • Add a configurable single-turn token budget confirmation gate, defaulting to 100,000 tokens via CLAW_TURN_TOKEN_CONFIRM_THRESHOLD.
  • Surface a dedicated CLI confirmation prompt when a turn exceeds the token budget.
  • Remove tracked .claude / .claw session transcripts and expand .gitignore so local sessions, settings, plugin installs, and locally installed skills stay out of future commits.

Privacy / Local State

  • Local API keys were not committed; staged additions were scanned for API key/token/secret patterns.
  • The locally installed grill-me skill is treated as local operator state under .claw/skills/grill-me and is now ignored rather than committed. It influenced this work as a review posture, but it is not a project dependency.
  • Note: because the upstream repository is public, an official GitHub fork inherits upstream history. This PR removes session artifacts from the branch tip and prevents future tracking, but it does not rewrite historical upstream commits.

Validation

  • cargo check -p runtime --lib
  • cargo check -p rusty-claude-cli
  • git diff --check
  • staged additions scanned for API key/token/secret patterns

Known Limits

  • cargo fmt could not run because rustfmt is not installed for the local stable Windows toolchain.
  • cargo test -p runtime --lib is currently blocked on Windows by existing Unix-only test code using std::os::unix::fs::PermissionsExt::set_mode in mcp_stdio.rs and mcp_tool_bridge.rs.

Adapt OpenAI-compatible DeepSeek V4 formatting by preserving reasoning_content, including explicit empty reasoning_content values, keeping assistant tool-call content as an empty string where required, and omitting tool_choice for DeepSeek V4 tool calls.

Run runtime compaction before outbound model requests and add a configurable single-turn token budget confirmation gate.

Remove tracked local .claude/.claw session transcripts and ignore local Claude/Claw state, including installed local skills such as grill-me.
@j169476 j169476 force-pushed the codex/harden-context-token-privacy branch from 2d6e514 to 2ae287b Compare May 13, 2026 17:59
@j169476 j169476 changed the title [codex] harden context compaction and token budget [codex] harden DeepSeek API format, context, and token budget May 13, 2026
@j169476 j169476 closed this May 13, 2026
@j169476 j169476 deleted the codex/harden-context-token-privacy branch May 13, 2026 18:09
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