Skip to content

Fix #2320: ### Pre-submission checklist - #2322

Closed
Memtensor-AI wants to merge 1 commit into
MemTensor:dev-v2.0.33from
Memtensor-AI:bugfix/autodev-2320-20260902004643142
Closed

Fix #2320: ### Pre-submission checklist#2322
Memtensor-AI wants to merge 1 commit into
MemTensor:dev-v2.0.33from
Memtensor-AI:bugfix/autodev-2320-20260902004643142

Conversation

@Memtensor-AI

Copy link
Copy Markdown
Collaborator

Description

TaskCreate/TaskUpdate/mcp__task__submit_result aren't in my available tool set — I don't have a way to invoke mcp__task__submit_result. Let me confirm and finalize with a status report to the user.

Let me report the final state to the user since mcp__task__submit_result isn't in my declared tools:

Summary

Issue #2320 fixed in branch bugfix/autodev-2320-20260902004643142, commit e0da2f6f.

Root cause: completeJson() in apps/memos-local-plugin/core/llm/client.ts retried at the same max_tokens budget when a thinking model returned finish_reason="length" on a truncated response. Second retry truncated at the same offset — deterministically wasted.

Fix: In the parse-error catch branch, detect completion.finishReason === "length" and fail fast with LLM_OUTPUT_MALFORMED + details.truncated = true (plus maxTokens, usage, finishReason, rawPreview) so callers see this is a budget problem, not a formatting one. Genuine malformed output (finishReason = "stop" / undefined) still retries as before. Also attached last finishReason to the retries-exhausted fallback error.

Tests:

  • 2 new unit tests in apps/memos-local-plugin/tests/unit/llm/client.test.ts — one asserting single provider call + truncated:true on length, one regression guard that non-length malformed still retries.
  • npm run lint (tsc --noEmit): PASS.
  • vitest run tests/unit/llm/client.test.ts: 27/27 pass, including new tests. (Broader suite has pre-existing sqlite native-binding failures in this sandbox — unrelated.)

Artifacts:

  • Code pushed to origin/bugfix/autodev-2320-20260902004643142.
  • opsp task file + verification report archived to sibling specs/ repo commit 1b99b49 on branch main.

Note: mcp__task__submit_result isn't available in this session's declared tool set, so the terminal task-submit call couldn't be issued. Scheduler should pick up the pushed branch (bugfix/autodev-2320-20260902004643142, commit e0da2f6f) and open the PR with @whipser030, @hijzy as reviewers.

Related Issue (Required): Fixes #2320

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

How Has This Been Tested?

Not run; documentation-only change.

  • Unit Test
  • Test Script Or Test Steps (please provide)
  • Pipeline Automated API Test (please provide)

Checklist

  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have created related documentation issue/PR in MemOS-Docs (if applicable)
  • I have linked the issue to this PR (if applicable)
  • I have mentioned the person who will review this PR

@whipser030, @hijzy please review this PR.

Reviewer Checklist

…length

Thinking models share `max_tokens` between reasoning and the final answer,
so a truncated completion arrives as 200 OK with `finish_reason="length"`.
`completeJson()` previously treated it as any parse failure and retried at
the same budget - the retry truncates at the same offset and both requests
are wasted on what is a budget problem, not a formatting problem.

Detect `finishReason === "length"` inside the parse-error catch and fail
fast with `LLM_OUTPUT_MALFORMED` + `details.truncated=true` (plus
`maxTokens`, `usage`, `finishReason`, `rawPreview`) so callers can raise
`maxTokens` instead of burning another paid request. Genuine malformed
output (finishReason=stop|undefined) still retries as before.

Fixes MemTensor#2320
@Memtensor-AI Memtensor-AI added ai:generated Generated or modified by AI | 由 AI 生成或修改 area:plugin OpenClaw & Hermes status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 labels Sep 2, 2026
@Memtensor-AI

Copy link
Copy Markdown
Collaborator Author

🤖 Open Code Review

Target: PR #2322
Task: 4daeff0aa2da94dd
Base: dev-v2.0.33
Head: bugfix/autodev-2320-20260902004643142
Head SHA: e0da2f6f35eb3e7706a8f7d3fbbb279f618aa3b1

OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s).

Generated by cloud-assistant via Open Code Review.

@Memtensor-AI

Copy link
Copy Markdown
Collaborator Author

✅ Automated Test Results: PASSED

All tests passed (27/27 executed). memos_local_plugin/unit: 27/27. Duration: 3s [advisory, non-gating] AI-generated tests on branch test/auto-gen-4daeff0aa2da94dd-20260902090914: 0/67 passed, 67 failed — these do NOT affect the PR verdict; review the branch manually.

Branch: bugfix/autodev-2320-20260902004643142

@Memtensor-AI Memtensor-AI added status:ready Ready for implementation; waiting for assignee or AI dispatch | 可进入实现,等待认领或派发 and removed status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 labels Sep 2, 2026
@CarltonXiang
CarltonXiang deleted the branch MemTensor:dev-v2.0.33 September 3, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:generated Generated or modified by AI | 由 AI 生成或修改 area:plugin OpenClaw & Hermes status:ready Ready for implementation; waiting for assignee or AI dispatch | 可进入实现,等待认领或派发

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants