Skip to content

Delivery dagid-schema-pattern - #413

Merged
LeXwDeX merged 5 commits into
devfrom
fix/412-dagid-schema-pattern
Aug 21, 2026
Merged

Delivery dagid-schema-pattern#413
LeXwDeX merged 5 commits into
devfrom
fix/412-dagid-schema-pattern

Conversation

@LeXwDeX

@LeXwDeXLeXwDeX commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Closes#412

Why

llama.cpp's OpenAI-compatible server rejects tool JSON Schemas whose pattern is not anchored at both ends. DagID's Schema.isStartsWith("dag") serialized to pattern: "^dag" (start-anchored only), so every request carrying the workflow tool (5 parameters reference Dag.ID) failed with JSON schema conversion failed: Pattern must start with '^' and end with '$'.

What changed

  • packages/schema/src/dag-event.ts: DagID filter switched from isStartsWith("dag") to isPattern(/^dag.*$/) — fully anchored pattern, identical starts-with validation semantics.
  • packages/schema/test/dag-id-pattern.test.ts: regression test asserting every serialized pattern is ^...$-anchored and validation semantics are unchanged.

Evidence

  • New test red before the fix (pattern ^dag failed both-anchors assertion), green after.
  • bun test in packages/schema: 19 pass.
  • bun test test/dag in packages/opencode: 615 pass; bun run test:dag-core: gate passed.
  • bun typecheck in packages/schema and packages/opencode: clean.
  • End-to-end: streaming chat completion against the llama.cpp server (192.168.33.110:8081) with a ^dag.*$ tool pattern is accepted (previously 400).

Checklist

  • Reproduced the failure (mitm capture showed 5 unanchored ^dag patterns)
  • Fix verified against the real llama.cpp endpoint
  • Typecheck + unit tests green locally
  • CI gates green

Release train: headless /init stamp fix + v1.0.30 series notes
llama.cpp's OpenAI-compatible server rejects tool schemas whose pattern
lacks ^...$ anchoring. isStartsWith("dag") serialized to ^dag and broke
every request carrying the workflow tool. isPattern(/^dag.*$/) keeps
identical starts-with semantics with a fully anchored pattern.
@LeXwDeX
LeXwDeX marked this pull request as ready for review August 21, 2026 02:29
@LeXwDeX
LeXwDeX changed the base branch from main to devAugust 21, 2026 03:16
@LeXwDeX
LeXwDeX merged commit 1970e69 into devAug 21, 2026
9 checks passed
@LeXwDeX
LeXwDeX deleted the fix/412-dagid-schema-pattern branch August 21, 2026 03:16
Sign up for freeto 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.

fix: DagID schema pattern only start-anchored, breaks llama.cpp tool JSON schema validation

1 participant

@LeXwDeX