Files
scriptorium/docs/roadmap/capture-diagnostics.md

3.5 KiB

Request: Safe PromptKit Capture Diagnostics

Status: request prepared locally; adoption is deferred until a supported PromptKit release supplies diagnostic evidence and ckprompt can present it. This is not an implemented diagnostic improvement or an upstream submission.

Consumer Problem

Scriptorium uses PromptKit v0.25.0 and ckprompt v0.12.0. Configuration can resolve successfully, yet engine construction can fail while capturing a prompt's message file or compiling its template. The application run and serve commands then report a generic initialization failure; native promptkit list prompts reports a generic listing failure. Operators cannot identify the resource or correct the failure from those explanations alone. The audit evidence in Git history records the retained causes.

Please provide supported public diagnostic evidence for capture failures that identifies the affected resource and configuration location, classifies the failure, and offers a useful explanation safe for operator display. Preserve typed causes and existing error classification. Please also make that evidence available to native ckprompt presentation, so both application commands and native PromptKit inspection can benefit. This request specifies consumer needs, not an internal representation or implementation.

Synthetic Reproduction

Use a temporary directory with the following app.yml and framework.yml. The missing-file case mirrors the server capture regression test:

# app.yml
config:
  imports:
    - path: framework.yml
      destination: [promptkit]
      required: true
transient_retries: 0
# framework.yml
prompts:
  - id: sample
    messages:
      - role: user
        content_file: absent-message.txt
    output:
      format: text
      validation_mode: none

From that directory, with a Scriptorium binary on the path, run:

scriptorium config validate --config=app.yml
scriptorium run sample --config=app.yml
scriptorium serve --config=app.yml
scriptorium promptkit list prompts --config=app.yml

Then replace the content_file line with content: '{{' and repeat. No provider or credentials are needed. Both cases were reproduced locally: config validation exits 0, while each other command exits 1 with empty stdout and a generic explanation. The application commands retain promptkit.ErrInvalidConfig as a cause; the missing-file failure also retains the filesystem not-exist identity (errors.Is(err, fs.ErrNotExist)). The malformed template cause retains template failure details but has no asserted separate public sentinel. The native command encounters the same capture failure; see the audit evidence for its Go-level cause observation.

Configuration inspection validates the resolved configuration; it is not the resource-capture lifecycle and does not compile templates or read message content. Moving capture into inspection would change that lifecycle. Raw causes must not simply be printed: other causes can contain prompt contents, provider payloads, or credentials. Supported, deliberately displayable evidence is needed instead of parsing error strings or exposing arbitrary cause text.

Adoption

Keep the existing generic capture explanations, statuses, and cause identities until an upstream public API and native presentation integration are released and evaluated. This pending cross-CLI dependency is independent of the HTTP-specific deferrals in future work.