Skip to content

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

Description

@LeXwDeX

Why

llama.cpp's OpenAI-compatible server rejects any tool JSON Schema whose pattern is not anchored at both ends (^...$). The workflow tool's workflow_id parameter is branded as Dag.ID, whose Effect Schema filter Schema.isStartsWith("dag") serializes to pattern: "^dag" — start-anchored only. Every request carrying the workflow tool is rejected with JSON schema conversion failed: Pattern must start with '^' and end with '$', so an opencode session pointed at a llama.cpp backend fails on the first message.

Evidence: mitm capture of the tool payloads showed 5 unanchored ^dag patterns (one per workflow-tool parameter referencing Dag.ID); server log shows the corresponding AI_APICallError.

Scope

  • packages/schema/src/dag-event.ts — make DagID's filter serialize to a fully anchored pattern (e.g. ^dag.*$) with identical validation semantics (starts-with).
  • Regression test asserting the JSON Schema serialization of Dag.ID is both-start-and-end anchored.

Acceptance

  • Generated tool parameter schemas for Dag.ID produce a pattern matching ^...\$ form accepted by llama.cpp (both anchors present).
  • Existing DagID validation semantics unchanged (any string starting with dag_ still valid).
  • specgit finish exits 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions