fix(routines): flat schedule schema + coercion so chat proposals survive provider schema conversion - #544
Merged
Merged
Conversation
…a, model-shaped coercion, guiding errors Field report (0.1.38, hours after #540 shipped): a bot's propose_routine failed on every attempt — the model tried a 30-minute interval, was told no, fell back to "daily", failed again, then gave up ("the routine proposal tool is returning errors every time — it's not accepting any input"). Reproduced the whole pipeline against a live server: the endpoint and proxy are correct for valid payloads. What actually breaks in the field is the tool's advertised schema: schedule was a oneOf of two const-discriminated branches — exactly the JSON-Schema keywords several agent CLIs flatten or drop when converting MCP tools into their provider's function-call format (codex only began preserving oneOf in June 2026; other drivers still simplify). A model that never saw the branches guesses shapes forever, and every guess failed with a message that never taught it the right one. Three changes, all proxy-side — the harness dialect is untouched: - The schedule schema is now one flat object (type enum once|weekly|daily + at/time/weekdays), free of oneOf/const/format, so it survives any conversion. Rules live in descriptions and are enforced with words. - normalizeScheduleInput coerces what models actually send: "daily" becomes weekly-on-all-seven-days on the wire, JSON-string schedules are parsed, weekday names are case-folded and short names (mon..sun) expanded. - Unsupported shapes now answer with instructions instead of a wall: a sub-day interval is named as unsupported with the closest alternatives, weekly-without-weekdays points at "daily", unknown types list the three supported shapes with examples. Verified end-to-end against a live server: daily / stringified / short-cap payloads now produce confirmation cards, interval and missing-weekdays get guiding errors, and the valid-weekly path is byte-identical. Mutation check: disabling the daily alias fails the new tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe routine schedule schema now uses a flat type enum. Schedule inputs are parsed, normalized, and validated before harness calls. Unsupported schedules return guidance through both proposal and update paths. ChangesRoutine schedule handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant MCPTool
participant routineFields
participant normalizeScheduleInput
participant Harness
MCPTool->>routineFields: Submit routine schedule
routineFields->>normalizeScheduleInput: Normalize schedule
normalizeScheduleInput-->>routineFields: Normalized schedule or error
alt Valid schedule
routineFields->>Harness: Send normalized routine
else Unsupported schedule
routineFields-->>MCPTool: Return guidance error
end
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
milind-soni
added a commit
that referenced
this pull request
Aug 28, 2026
…sion eats composition keywords (#547) Codified from the #544 field failure: schedule was a oneOf of const-branches, several engines' MCP-to-provider converters flattened it, and models guessed shapes forever. The rule, the coercion posture, and the errors-must-teach posture now live next to the driver SPI guidance so the next tool surface doesn't relearn it in production. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This was referenced Aug 28, 2026
pull Bot
pushed a commit
to dubbypanda/OpenMausBot
that referenced
this pull request
Aug 29, 2026
…turns while things boot Stolen from vercel-labs/fx's terminal monitors. A bot that starts a dev server or kicks off a long job currently polls with repeated computer_exec or screenshot calls — one model inference per peek. wait_for runs the whole wait in ONE round trip: a 2s poll loop on the box (http_ready / tcp_ready / output_matches / file_exists, bounded 1-240s), then the settled screen rides back in the same result, matching the file's act-and-observe contract. The schema is flat (enum + per-condition fields described in words) and bad input answers with a copyable example instead of a wall — both per the CONTRIBUTING "MCP tool schemas" rules from milind-soni#544. A timeout returns advice (inspect with computer_exec) rather than an invitation to wait again, and the preview poker learns the tool name so the panel refreshes. Verified: 22/22 proxy contract tests (schema flatness guard, free-of-charge guidance on bad input, single-round-trip with frame, timeout advice, bash -n on every generated shell); mutation check (breaking the loop's sentinel fails 3 tests); tsc clean; lint parity with main (14 = 14 findings). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What changed
propose_routine's schedule schema and input handling in the agents MCP proxy. Harness dialect and server are untouched.oneOf/const/format. The schedule was aoneOfof twoconst-discriminated branches — exactly the JSON-Schema composition keywords several agent CLIs flatten or drop when converting MCP tools into their provider's function-call format (codex-rs only began preservingoneOfin June 2026,codex-rs/tools/src/json_schema.rs#24118; its large-schema compaction still prunes compositions; other drivers simplify harder). A model that never saw the branches guesses shapes forever. The schema is now one flat object (type: once|weekly|daily+at/time/weekdays) with the rules in descriptions.normalizeScheduleInput):"daily"→ weekly-on-all-7-days on the wire; JSON-string schedules parsed; weekday names case-folded, short names (mon…sun) expanded.weeklywithoutweekdayspoints at"daily"; unknown types list the three supported shapes with examples. Same forpropose_routine_actionupdate changes.Why
Field report hours after 0.1.38 shipped #540: a bot (gpt-5.6-sol) failed
agents_propose_routineon every attempt — tried a 30-min interval, concluded "only weekly is supported, best I can do is daily", senttype:"daily", failed six more times, then told the user "the routine proposal tool is returning errors every time — it's not accepting any input."I reproduced the full pipeline against a live server (real proxy → real
/api/internal/routine-requests): valid payloads work — the field failures are all model-shaped inputs, and the old replies never taught the model the correct shape:type:"daily"Invalid discriminator value. Expected 'once' | 'weekly'["Mon","FRI"]Invalid discriminator value…expected array, received undefineduse {"type":"daily"}guidanceHow it was verified
npx vitest run server/drivers/agents-proxy.test.ts— 20 pass. New: flat-schema assertion (regexp-guards against any composition keyword reappearing in the tool surface), daily-alias wire shape, case/short weekday folding, string-schedule parsing, guided errors that never reach the harness. Existing weekly/once passthrough tests unchanged.pnpm typecheckclean. Lint: this file has 35 pre-existing anti-slop findings on main; the additions follow the file's existing no-depstypeof-boundary style (6 more of the same rules; lint is not a CI gate — flagging for transparency).Note for reviewers
The same conversion fragility applies to any future MCP tool schema: avoid
oneOf/anyOf/constin tool inputs — flat objects + description-enforced rules + instructive errors survive every driver. Might be worth a line in CONTRIBUTING.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes