Merge dev to main: friction params loosened + cascade-tools missing-dist UX#1312
Merged
Conversation
Co-authored-by: Cascade Bot <bot@cascade.dev>
Co-authored-by: Cascade Bot <bot@cascade.dev>
Co-authored-by: Cascade Bot <bot@cascade.dev>
…de-tools missing-dist UX Live signal from prod 2026-05-10 run ff6adf00 (cascade implementation post the friction-prompt rewrite of #1305): the agent recognized a textbook friction (CASCADE_ORG_ID env-var leak in tests, worked around with `env -u`), fired `cascade-tools pm report-friction` four times, and EVERY call exited code 2 because oclif's enum gate rejected `--severity 'medium slowdown'` (and `'low annoyance'`). The agent then attempted `node bin/cascade-tools.js pm report-friction --help` to discover valid values, which crashed with `ERR_MODULE_NOT_FOUND` for `dist/cli/bootstrap.js` because dist/ wasn't built in the workspace checkout. Agent gave up. Report never filed. Two distinct bugs in one trace: 1. **Enum coupling between describe text and validation.** The gadget defined `severity.type: 'enum'` with options ['low','medium','high', 'critical'] AND describe text 'Severity: low annoyance, medium slowdown, high blocker risk, or critical hard blocker'. The describe injected descriptive prose alongside values. Codex's prompt-tool- guidance only renders `<enum>` (per formatParam in nativeToolPrompts.ts) — agents had only the describe + example to guess from, and the describe led them to 'medium slowdown' as the literal value. 2. **bin/cascade-tools.js dumped a raw stack trace** when dist/ was missing — hid the recovery path (use the installed `cascade-tools` from PATH inside the worker container, or `npm run build`). Decision: defer enum tightening. Accept any string for category/severity for now — the agent is the right place for free-form labels initially; cluster + re-tighten later from real usage data. Plus a small UX patch on bin/cascade-tools.js so missing dist no longer dumps a stack trace. Changes: - src/gadgets/pm/definitions.ts: category/severity → type:'string', describe text rewritten so values are listed inside parentheses rather than mixed with prose. - src/gadgets/pm/core/reportFriction.ts: drop CATEGORIES/SEVERITIES arrays + requireEnum helper + the two requireEnum call sites; pass params.category/severity through verbatim. - src/friction/types.ts: widen FrictionCategory and FrictionSeverity unions → `string` (preserves import paths for downstream consumers). - bin/cascade-tools.js: wrap the `dist/cli/bootstrap.js` import in try-catch with a narrow regex classifier; emit one-line stderr message + exit 1 on missing-dist; any other module-not-found propagates unchanged. Tests: - tests/unit/gadgets/pm/definitions.test.ts: flipped enum assertions to string, pinned `options` is undefined (regression net for revert), pinned the new describe text verbatim. - tests/unit/gadgets/pm/core/reportFriction.test.ts: replaced the "rejects invalid category" test with a positive test that an agent-invented label like 'something-not-in-the-old-enum' / 'medium slowdown' is stored verbatim and processed. - tests/unit/backends/toolManifests.test.ts: kept the existing manifest assertions (already correct — manifest generator coerces enum→string) + added options-undefined regression net. No new bin test — adding spawn-based fixtures for missing-dist introduces more fragility than value for a 5-line try-catch. The existing tests/unit/cli/cascade-tools-help.test.ts spawn pattern already shows known fragility (NODE_ENV stripping, dist-built skip). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ion-params-and-harden-bin chore(friction): loosen category/severity to free-form + harden cascade-tools missing-dist UX
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
🤖 Generated with Claude Code