Sitelet https://github.com/brianonbased-dev/HoloScript/pull/409
Skip to content

fix(mcp-server): every knowledge write says what the orchestrator did, and a refused daemon batch is retried - #409

Open
brianonbased-dev wants to merge 2 commits into
claude1/orchestrator-client-timeoutsfrom
claude1/knowledge-writes-name-refusals
Open

brianonbased-dev wants to merge 2 commits into
claude1/orchestrator-client-timeoutsfrom
claude1/knowledge-writes-name-refusals

Conversation

@brianonbased-dev

Copy link
Copy Markdown
Owner

What this fixes

Four knowledge routes and one MCP tool answered success when the orchestrator refused the write, although none of them keeps a copy of its own. The caller was told something was saved that exists nowhere. The daemon also marked a refused batch as contributed, so it was never retried.

Task: task_1790588967474_xzgt (claude3's re-read of #319). Stacked on #408, since they share the client and the test file. Merge #408 first, then retarget this to main.

The change

  • POST /contribute, POST /knowledge/private, POST /knowledge/promote and DELETE /knowledge/private/:id answer 502 on a refusal and 503 when the orchestrator is unreachable. This goes through one helper, answerUnacceptedWrite, which fix(mcp-server): a knowledge write reports what the orchestrator accepted and names a refusal (w6ui) #319's POST /knowledge now shares.
  • The holomesh_contribute tool says success: false and why. holomesh_publish_tool stays a success, since its manifest is local, and now reports whether the knowledge copy landed.
  • The daemon only marks entries contributed when every row was taken. Otherwise the batch is retried next cycle.
  • Client fixes:
    • {success:false} with no count is not acceptance.
    • A byte-order mark no longer breaks JSON parsing.
    • An answer over 64 KiB is named as such.
    • The timeout setting is clamped: Node throws above 2^32-1, which read as "unreachable".
  • The team route's mirror-first order is now pinned by a test, and it logs one line when rows live only in the mirror.

Proof

Not done: the stand-in port does not retry on EADDRINUSE. The port is fixed before import; the odds are about 1 in 20,000 per run.

Needs a distinct-seat review (author: claude1 / claudecode-x402).

🤖 Generated with Claude Code

claudecode-claude-x402 and others added 2 commits September 28, 2026 05:39
…, and a refused daemon batch is retried

task_1790588967474_xzgt: claude3-x402's re-read of #319 at bd05d52 (room
msg_1790219322472_d0cjwe .. msg_1790219332311_ac825g), and the artifacts
in C:\holo-dev\.scratch\claude3-review-artifacts\319b\.

P2-A. team-routes wrote its mirror before the orchestrator, but no test
pinned that order, and mutants N05/N21 survived all 269 tests. New test:
the stand-in goes silent on the write only, and the team's knowledge is
read while the POST is still waiting. Both rows must be there. It also
checks the new warning line.

P2-B. Four routes and a tool answered a refusal as success, though none
keeps a copy of its own:
- POST /contribute answered 201.
- POST /knowledge/private answered 201.
- POST /knowledge/promote answered 201 (not in the review's list, same
  class).
- DELETE /knowledge/private/:id answered 200.
- The holomesh_contribute tool answered success:true, synced:0.
Each now answers 502 when the orchestrator refused and 503 when it could
not be reached. The routes do this through one helper,
answerUnacceptedWrite in holomesh/utils.ts, which #319's
POST /knowledge now uses too; the tool says success:false. The error names
the status and reason, never the orchestrator's text.

holomesh_publish_tool stays a success, because its manifest really is
published locally. It now says whether the knowledge copy landed.

The daemon marked a batch contributed whatever the orchestrator answered,
so a refused entry was never retried. Both daemon sites now mark nothing
unless every row was taken.

P3, in the client:
- An answer saying success:false with no count is no longer read as the
  whole batch accepted.
- A leading byte-order mark is stripped before JSON.parse.
- An answer over 64 KiB is named as that, not as "without a JSON body".
- The timeout setting is clamped. Node's AbortSignal.timeout throws on
  values above 2^32-1, and every request then read as unreachable.
- The team route logs one line (count and reason, no body) when its rows
  live only in the mirror.
Not done: the test's stand-in port does not retry on EADDRINUSE. The port
is fixed before import (vi.hoisted), and a retry would need a restructure;
the collision odds are about 1 in 20,000 per run.

Verified:
- 10 new tests fail before the fix, and 1 new daemon test fails on the old
  daemon. The ordering test passes on the correct order: it is a pin.
  Controls stay green: accepted writes still answer 201/200, and the tool
  still succeeds.
- The outcome, client and daemon test files: 117/117.
- Each part broken alone: 13 of 13 red, each on its own test. The parts
  are: the mirror order, the helper, each of the four routes, the tool,
  the daemon, success:false, the byte-order mark, the oversized answer,
  the clamp, and the log line.
- tsc 0 errors. The files that were prettier-clean stay clean. The outcome
  test file was already unformatted from #319; it is formatted on its own
  in the next commit.

Stacked on #408 (claude1/orchestrator-client-timeouts): the two changes
share the test file and the client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…formatting only)

The file has been unformatted since #319. Kept apart from the fix so the fix
reads as its own delta. prettier --write, nothing else; 24/24 still pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

triage 2026-10-05: open-cap ≤5; recreate from main if needed

Copy link
Copy Markdown
Owner Author

reopened 2026-10-05: Joseph GO — security/hosted-server triage restore

@brianonbased-dev

Copy link
Copy Markdown
Owner Author

HoloCI verdict: FAIL

HoloCI checked the head commit of this pull request with the quick profile.

  • Failed: python-honesty, secrets, lint, type-check
  • Passed (8 of 12): doctrine-slots, mcp-gate-coverage, publish-surface, dockerfile-static-check, cross-platform-paths, docker-core-entries, frozen-lockfile, render-surface
  • Could not run: none
  • Commit: 2fd1f37aed51a35c5fee1bb61731f705c15c2dc9
  • Receipt: c3699c3b60b328aae3dc6f7c2f3fba2c0c619e5ad144cd3f9c643ae51ef9336c (workload ci-2fd1f37a-muxyjwrg)

Fix the failed gates and push. HoloCI checks the new head commit on its own.

This branch has not been deployed

No deployments
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