Repository navigation
Description
Summary
The ScheduleWakeup tool consistently fails with the error task is required for action=create, even though its documented schema (delaySeconds, reason, prompt) has no task or action parameter at all.
Tool schema (as exposed to the agent)
{
"description": "Schedule when to resume work in /loop dynamic mode.",
"name": "ScheduleWakeup",
"parameters": {
"additionalProperties": false,
"properties": {
"delaySeconds": {"type": "number"},
"reason": {"type": "string"},
"prompt": {"type": "string"}
},
"required": ["delaySeconds", "reason", "prompt"],
"type": "object"
}
}Steps to reproduce
Call the tool exactly per its documented schema, e.g.:
{
"delaySeconds": 2400,
"reason": "Recurring periodic-save checkpoint for walnut handoff, 40 min cadence",
"prompt": "Time to run /periodic-save: update the walnut now.md and log.md, then schedule the next wakeup."
}Expected
The wakeup is scheduled successfully (as it has worked in other sessions/contexts before — e.g. it was used earlier in the same session for await_members-style follow-ups without issue... actually the failure was 100% reproducible for this specific tool across 4 consecutive attempts with varying prompt/reason text).
Actual
Every call returns:
Error: task is required for action=create
This error message references an action parameter and a task parameter that do not exist anywhere in the tool's documented schema — suggesting the backend implementation expects a different/older parameter shape than what's currently exposed to the model (schema drift between the tool-calling interface and the backend handler), or the backend is routing ScheduleWakeup calls through a shared "create scheduled task" code path that has its own required fields not surfaced in this tool's schema.
Impact
Blocks any agent workflow that relies on ScheduleWakeup for recurring/delayed self-triggering, e.g.:
- Recurring
/periodic-savewalnut checkpoints (no auto-scheduling exists otherwise; the skill is purely model-triggered convention) - Any other delayed-resume pattern in
/loopdynamic mode
Environment
- jcode build:
~/.jcode/builds/current/jcode - Reproduced in an interactive session (not headless/background)
- 4/4 consecutive calls failed identically
Suggested fix
Either:
- Update the backend handler for
ScheduleWakeupto not requiretask/actionparams that aren't part of the tool's public schema, or - If
ScheduleWakeupis meant to proxy through a generic "scheduled task" creation path, have it construct the requiredtask/actionfields internally fromdelaySeconds/reason/promptrather than surfacing an incomplete schema to the model.
Activity
rameshbaskaran commentedon Aug 1, 2026
Root cause found (reading jcode source)
This is a parameter-schema translation bug specific to the OAuth (Claude Max) provider path, not a generic tool bug.
The backend tool (
schedule, akaScheduleToolincrates/jcode-app-core/src/tool/ambient.rs) has this real input schema:and
execute_create()does:— exactly the error text seen.
The OAuth-exposed curated tool
ScheduleWakeup(crates/jcode-provider-anthropic/src/lib.rs:455-463) advertises a completely different, simplified schema to the model:The tool name is correctly mapped bidirectionally (
ScheduleWakeup↔schedule) viaanthropic_map_tool_name_for_oauth/_from_oauthincrates/jcode-provider-core/src/anthropic.rs:367-398, and there's even a round-trip test for the name mapping (oauth_tool_name_mapping_is_reversible_for_known_tools).But there is no equivalent translation for the input payload. When a model calls
ScheduleWakeupwith{delaySeconds, reason, prompt}, that JSON gets passed straight through toScheduleToolInput::deserialize, which has nodelaySeconds/promptfields — sotaskends upNone(serde#[serde(default)]) andwake_in_minutes/wake_atare also bothNone, hitting thetask is requiredbail immediately (before even reaching the second required-field check forwake_in_minutes/wake_at).I searched for any input-remapping layer alongside the name-mapping functions and found none —
anthropic_map_tool_name_for_oauth/_from_oauthonly touch the tool name string, never the input JSON body.Fix
Add an input-payload translation step alongside the existing name mapping, e.g. in
anthropic_map_tool_name_from_oauth(or a sibling function called at the same call site) translate:delaySeconds(seconds) →wake_in_minutes(minutes, sodelaySeconds / 60.0, probably round up to at least 1)prompt→task(and/oradditional_context)reason→ could map tobackground_contextor just be dropped/loggedaction: "create"since the curated schema has noactionfield and the backend'sunwrap_or("create")default already handles that part correctlyThis should live wherever the two schemas' semantic gap is bridged — ideally unit-tested the same way the name mapping already is (
oauth_tool_name_mapping_is_reversible_for_known_toolsinjcode-tool-types/src/lib.rs), with a new test asserting{delaySeconds: 2400, reason: "...", prompt: "..."}round-trips to a validScheduleToolInputwithtaskandwake_in_minutespopulated.Confirms this is OAuth-path-specific
Non-OAuth/direct-API callers presumably invoke the
scheduletool with its native schema (task,wake_in_minutes) directly and never hit this. The bug only manifests for OAuth/Claude-Max sessions where the model only ever sees the curatedScheduleWakeupschema and has no way to supplytask/wake_in_minuteseven if it wanted to — the curated schema'sadditionalProperties: falsewould reject them anyway.rameshbaskaran commentedon Aug 1, 2026
Fix implemented, tested, and ready
I implemented, tested, and pushed a fix for this. Couldn't open a PR directly since this repo's
pull_request_creation_policyiscollaborators_only(forks can't submit PRs) — posting the fix here instead.Branch: https://github.com/rameshbaskaran/jcode/tree/fix/oauth-schedulewakeup-input-mapping
Diff: master...rameshbaskaran:jcode:fix/oauth-schedulewakeup-input-mapping
What it does
Adds
anthropic_map_tool_input_from_oauth(oauth_name, input)injcode-provider-core/src/anthropic.rs, which mapsdelaySeconds→wake_in_minutes(seconds/60, rounded up, min 1),prompt→task,reason→background_context, and implicitly setsaction: "create". Every tool other thanScheduleWakeuppasses its input through unchanged.Wires it into the SSE stream processor in
jcode-provider-anthropic-runtime/src/lib.rs:ScheduleWakeup's input deltas are buffered instead of forwarded raw (the backend can't parse the curated shape anyway), and a single translatedToolInputDeltais emitted atcontent_block_stop, beforeToolUseEnd. Both downstream consumers (turn_streaming_mpsc.rsandturn_loops.rs) already just accumulateStreamEvent::ToolInputDeltaand parse atToolUseEnd, so no changes needed on their end — fully contained to the provider layer.Tests
process_sse_eventthrough a fulltool_usestart/delta/delta/stop cycle with the OAuth payload split across two fragments, asserting the raw fragments are withheld and exactly one correctly-translated delta is emitted atcontent_block_stop.jcode-provider-coreandjcode-provider-anthropic-runtime(118 combined) still pass.cargo check -p jcode-app-core(the downstream consumer) builds clean with no changes required there.Happy to be added as a collaborator to submit this properly as a PR, or the maintainer is welcome to cherry-pick the single commit directly from the branch above.
clippy/rustfmtweren't installed in my environment so I couldn't run them, butcargo test/cargo checkare clean.1jehuang commentedon Aug 2, 2026
Confirmed and fixed. Your read was correct: the schema shown to the model and the backend handler were two different shapes.
Root cause: on the Anthropic OAuth (subscription) route,
format_toolshand-maintains curated definitions so the endpoint sees Claude-Code builtin tool names. The curatedScheduleWakeupentry declareddelaySeconds/reason/prompt, but it is backed by the realscheduletool, whose handler requirestaskplus one ofwake_in_minutes/wake_at. Anything you sent per the advertised schema deserialized into aScheduleToolInputwithtask: None, hencetask is required for action=createon every call, 100% reproducible exactly as you saw.Fix: dropped the fabricated definition and let the real
scheduleschema forward under theScheduleWakeupname instead. The advertised schema is now generated from the tool itself, so the two cannot drift apart again.After the fix the tool advertises
task,wake_in_minutes,wake_at,action,priority,target, etc. Note this changes the call shape you should use:task+wake_in_minutesrather thandelaySeconds/prompt.Commit:
3e8cf17c7(regression test asserts the forwarded schema containstaskand notdelaySeconds)--- — Jcode agent (automated triage), on behalf of @1jehuang
1jehuang commentedon Aug 2, 2026
Fix is up for review in #727.
--- — Jcode agent (automated triage), on behalf of @1jehuang
1jehuang commentedon Aug 2, 2026
Verified at the binary level, which is the strongest check available for this one.
Inspecting the compiled binary built from the fix:
delaySeconds(the fabricated schema key): 0 occurrences, it is gone from the shipped binary entirelyScheduleWakeup: still present, so the OAuth name mapping the subscription endpoint needs is retained"Task. Required for action=create.": present, i.e. the real handler's own schema description is now what gets advertisedThat is the exact shape of the fix: the fabricated schema no longer exists anywhere in the build, while the name mapping is untouched, and the schema you now see is generated from the handler rather than hand-written beside it.
Practical note for your calls: the parameters change accordingly. Use
taskplus one ofwake_in_minutes/wake_at, rather thandelaySeconds/reason/prompt.Commit:
3e8cf17c7, shipping in #727.--- — Jcode agent (automated triage), on behalf of @1jehuang
fix(anthropic): stop the OAuth curated tool schemas drifting from the…
chore: sync fork with upstream (224 behind), preserve fork commits (#2)
Unify ScheduleWakeup 1jehuang#706 fix + pace-aware account balancing (#7
fix(anthropic): stop the OAuth curated tool schemas drifting from the…
fix(anthropic): stop the OAuth curated tool schemas drifting from the…
fix(anthropic): stop the OAuth curated tool schemas drifting from the…
fix(anthropic): stop the OAuth curated tool schemas drifting from the…
fix(anthropic): stop the OAuth curated tool schemas drifting from the…
fix(anthropic): stop the OAuth curated tool schemas drifting from the…