Skip to content

Add request-shape prefix diagnostics - #21

Merged
likun666661 merged 1 commit into
apache:mainfrom
likun666661:deepseek-cost-runtime-phase2
Jun 16, 2026
Merged

likun666661 merged 1 commit into
apache:mainfrom
likun666661:deepseek-cost-runtime-phase2

Conversation

@likun666661

Copy link
Copy Markdown
Member

Refs #19.

Summary

  • Add request-shape prefix diagnostics on the existing RuntimeRunner -> AiSdkFlow -> AiSdkBackend -> ModelAdapter path, with per-session prefixHash and prefixChangeReason propagation through token usage, RuntimeEvents, run trace, and LLM telemetry.
  • Canonicalize AI SDK tool assembly by sorting provider-visible tool names, placing the internal invalid repair tool last, and using the same deterministic order for activeTools and repair candidates.
  • Move volatile desktop session environment facts (cwd/git/date/platform) out of the durable system prompt and into a current-turn tail, while preserving durable personalization, skills, workspace instructions, memory, bot, and deep-research system prompt fragments.

Rive Review

  • Workflow: maka.deepseek-cost-runtime-phase2@1
  • Run: wfrun_e81d5db134fb48e796cdf09678072186
  • Review artifact: /tmp/rive-maka-phase2-request-shape-20260616/output/02-review-report.md
  • Review found one required fix: update the Runtime source-contract test for the new diagnostic-bearing RunTrace call shapes. Fixed in this PR before commit.

Validation

  • npm run typecheck
  • npm --workspace @maka/runtime test (462/462)
  • npm --workspace @maka/core test (614/614)
  • npm --workspace @maka/storage test (81/81)
  • npm --workspace @maka/desktop test (1399/1399)
  • npm run build
  • git diff --check
  • Live DeepSeek product-path smoke with local key: two deepseek-chat turns returned OK; first turn reported prefixChangeReason=first_turn, second reported stable, both shared the same prefixHash. DeepSeek returned normalized miss counters for both turns (input=2306, cacheMissInput=2306, cacheHitInput=0, output=1), so this smoke verified the local diagnostic path and provider usage-field normalization but did not observe a cache-hit token in this run.

@likun666661
likun666661 merged commit 4a2f302 into apache:main Jun 16, 2026
jackwener pushed a commit that referenced this pull request Jun 21, 2026
jackwener pushed a commit that referenced this pull request Jun 21, 2026
jackwener pushed a commit that referenced this pull request Jun 21, 2026
jackwener pushed a commit that referenced this pull request Jun 21, 2026
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