Skip to content

docs(roadmap): add #458 — no portable success-detection field across --output-format json envelopes; only kind is universal#3071

Open
Yeachan-Heo wants to merge 1 commit into
mainfrom
docs/roadmap-458-cross-subcommand-envelope-hygiene
Open

docs(roadmap): add #458 — no portable success-detection field across --output-format json envelopes; only kind is universal#3071
Yeachan-Heo wants to merge 1 commit into
mainfrom
docs/roadmap-458-cross-subcommand-envelope-hygiene

Conversation

@Yeachan-Heo
Copy link
Copy Markdown
Contributor

ROADMAP pinpoint #458 — cross-subcommand JSON envelope catalog: only kind is universal

Dogfooded for the 2026-05-24 09:00 Clawhip pinpoint nudge (message 1508031832669814834).

Catalog of top-level fields across success envelopes

Clean isolated env, no .claw.json, fresh git-init workspace:

Subcommand kind status action summary message report
status "status" "ok"
mcp "mcp" "ok" "list"
skills "skills" "list"
agents "agents" "list"
doctor "doctor"
sandbox "sandbox"
init "init"
system-prompt "system-prompt"
version "version"

Only kind is universal. Every other top-level discriminator is present on some envelopes and missing on others.

Why it matters

Why distinct from existing items

Existing Surface
#90 / #91 / #92 / #110 / #115 / #116 / #130 Error envelope shape asymmetry ({error, type} vs {kind, error})
#340 / #341 / #347 / #349 / #350 Specific subcommand envelopes where not-found/unsupported is shaped wrong
#121 doctor message/report byte-duplication (one symptom)
#458 Cross-subcommand catalog of success envelopes — the meta-pattern that the above are individual instances of

This is the structural fact that no single top-level field is present on every success envelope, so no portable success detection is possible across the catalog without per-subcommand special-casing.

Trace

Every envelope is emitted from a separate code path with no shared envelope constructor:

  • status JSON at main.rs:5738 emits "status": "ok" directly
  • mcp JSON emits both status:"ok" and action:"list"
  • skills / agents emit action:"list" and summary but no status
  • doctor JSON at main.rs:1905-1923 emits kind/message/report/has_failures/summary{ok,warn,fail,total}/checks[] — no status field at all, while every checks[i] has its own status
  • sandbox / init / system-prompt / version each emit different ad-hoc shapes

There is no EnvelopeBuilder / BaseEnvelope shared struct that guarantees a uniform success/error discriminator.

Required fix shape (full detail in ROADMAP entry)

(a) Define a single shared BaseEnvelope: {kind, status: "ok"|"warn"|"error", action: …|null, summary: "<one-line>", details: <command-specific>}. Two universal fields: kind + status. (b) Drop ad-hoc message/report in favor of summary (one line) + optional text_render. (c) doctor rollup: top-level status derived from has_failures and summary.warnings. (d) Contract test that parses every subcommand's JSON, asserts kind matches subcommand name and status ∈ {ok,warn,error}. (e) Doc the envelope in docs/json-envelope-contract.md.

Acceptance check (one-liner)

for c in status mcp skills agents doctor sandbox init system-prompt version; do
  claw $c --output-format json 2>&1 | jq -e '.kind and (.status | IN("ok","warn","error"))' || echo "FAIL: $c"
done

Should print no FAILs.


[repo owner's gaebal-gajae (clawdbot) 🦞]

…--output-format json envelopes; only kind is universal
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.

2 participants