Skip to content
This repository was archived by the owner on Sep 30, 2026. It is now read-only.

Fix ScheduleWakeup OAuth schema mismatch rejecting every create - #3

Merged
yjuyjuy merged 1 commit into
masterfrom
fm/jcode-schedulewakeup-schema-mismatch
Aug 5, 2026
Merged

yjuyjuy merged 1 commit into
masterfrom
fm/jcode-schedulewakeup-schema-mismatch

Conversation

@yjuyjuy

@yjuyjuy yjuyjuy commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Problem

On the Anthropic OAuth (Claude Max subscription) route, every ScheduleWakeup create call failed with:

task is required for action=create

Root cause

The OAuth tool surface remaps a small allow-list of builtin tool names on the wire (schedule is advertised to the model as ScheduleWakeup). For schedule, the curated OAuth entry also carried a hand-tuned input schema that did not match the backend:

  • Advertised OAuth schema: { delaySeconds, reason, prompt } (all required)
  • Backend schedule handler deserializes: { task, wake_in_minutes | wake_at, priority, target, ... }

Only the tool name is remapped inbound, never the arguments. So when the model called ScheduleWakeup with the advertised params, serde deserialized them into ScheduleToolInput, dropped the unknown delaySeconds/reason/prompt fields, left task as None, and the handler rejected the call. The tool was unusable on OAuth.

Fix

Remove schedule from the curated OAuth builtin list and from OAUTH_BUILTIN_LOCAL_TOOLS. It now flows through the generic registry-forwarding path used for every other custom tool, which advertises the real backend schema (single source of truth) under the mapped name ScheduleWakeup. The name allow-list mapping (schedule <-> ScheduleWakeup) is unchanged, so nothing else about the OAuth contract shifts. This is the minimal, idiomatic fix: it deletes the divergent fabricated schema rather than papering over it with an argument translator.

Tests

  • New regression test oauth_forwards_schedule_backend_schema_under_scheduled_wakeup_name asserts the OAuth ScheduleWakeup tool exposes the backend task param and never the fabricated delaySeconds param.
  • cargo test -p jcode-provider-anthropic: 12 passed.
  • cargo test -p jcode-app-core --lib schedule: 30 passed (backend accept + wake behavior).
  • cargo clippy -p jcode-provider-anthropic -- -D warnings: clean.

Bug reproduced before the fix (live ScheduleWakeup call returned task is required for action=create) and the reproduction path is now covered by the regression test.

Wake behavior (does a scheduled wakeup actually wake an idle session?)

Yes, for target: "resume" (the default) into a live idle session. The scheduled-item delivery path is:

ambient runner -> deliver_scheduled_direct_item -> notify_live_session -> Client::notify_session

This is an active re-drive, not a passive notify. The existing test notify_session_runs_scheduled_task_immediately_for_idle_live_session (in crates/jcode-app-core/src/server/client_actions_tests.rs) confirms that notifying an idle live session injects the scheduled reminder as a user turn AND the model immediately produces assistant output (stop_reason cycle runs to completion). If the target session is dead rather than live, delivery falls back to resume_dead_session_with_reminder, which loads the session headlessly and runs one capture cycle.

So a scheduled wakeup with target: resume genuinely re-drives an idle session (wake:true semantics), which is the model-wakeable primitive needed for self-wake. Note: target: ambient is notify-only, and target: spawn runs a fresh child session instead of waking the originator; use resume for self-wake.

The Anthropic OAuth tool surface advertised a hand-tuned `ScheduleWakeup`
schema with `delaySeconds`/`reason`/`prompt`, but the backend `schedule`
tool deserializes `task`/`wake_in_minutes`/`wake_at`. Only the tool name is
remapped on the wire, not the arguments, so a model calling the advertised
params produced an input where serde dropped the unknown fields and `task`
defaulted to `None`, failing with "task is required for action=create".

Remove `schedule` from the curated OAuth builtin list and from
`OAUTH_BUILTIN_LOCAL_TOOLS` so it flows through the generic
registry-forwarding path. That advertises the real backend schema (single
source of truth) under the mapped name `ScheduleWakeup`, keeping the name
allow-list mapping intact while the parameters now match the handler.

Add a regression test asserting the OAuth `ScheduleWakeup` schema exposes
the backend `task` param and never the fabricated `delaySeconds` param.
@yjuyjuy
yjuyjuy merged commit 64610a1 into master Aug 5, 2026
3 of 10 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant