Skip to content

fix(scheduler): use explicit execution prefix for scheduled task injection (#2073)#2075

Merged
bug-ops merged 1 commit intomainfrom
fix-2073-scheduler-task-injection
Mar 20, 2026
Merged

fix(scheduler): use explicit execution prefix for scheduled task injection (#2073)#2075
bug-ops merged 1 commit intomainfrom
fix-2073-scheduler-task-injection

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Mar 20, 2026

Summary

Fixes issue #2073: Scheduler task injection format is ambiguous — LLM cancels bash tasks instead of executing them.

Problem

When the scheduler fires a deferred task via the custom_task_tx injection path, the injected message was formatted as:

[Scheduled task] bash -c 'echo hello > /tmp/output.txt'

This is ambiguous. With gpt-4o-mini, the LLM interprets this as informational metadata and calls cancel_task instead of executing the bash command.

Solution

Replace the ambiguous [Scheduled task] prefix with the explicit execution directive:

Execute the following scheduled task now: bash -c 'echo hello > /tmp/output.txt'

This imperative wording prevents LLMs from misinterpreting the annotation as metadata.

Changes

  1. Agent loop (crates/zeph-core/src/agent/mod.rs): Introduced SCHEDULED_TASK_PREFIX constant and updated the injection format at line 2101.
  2. Scheduler fallback (crates/zeph-scheduler/src/scheduler.rs): Updated oneshot fallback format at line 316-319.
  3. CustomTaskHandler (crates/zeph-scheduler/src/handlers.rs): Updated handler fallback format at line 33 + updated related test.
  4. Documentation: Updated all references in SKILL.md, scheduler.md, daemon.md.
  5. Unit test: Added test_scheduled_task_injection_format to verify the new format (references the constant to prevent silent drift).

Verification

  • ✅ All pre-commit checks pass: cargo +nightly fmt, cargo clippy, cargo nextest
  • ✅ 6265 tests pass (+1 new unit test)
  • ✅ All validators approved: tester, security, impl-critic, reviewer
  • ✅ No unrelated changes bundled

Test Plan

  1. Unit test: test_scheduled_task_injection_format validates the new format string.
  2. Integration: Existing scheduler injection tests continue to pass.
  3. Live test: Next CI cycle will verify with gpt-4o-mini that bash tasks are no longer cancelled.

Issue Resolution

Resolves #2073 completely. The format change applies to all three scheduler injection points (agent loop, oneshot fallback, handler fallback), preventing LLM misinterpretation across all code paths.

@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate bug Something isn't working size/S Small PR (11-50 lines) labels Mar 20, 2026
…ction (#2073)

Replace the ambiguous `[Scheduled task] <task>` prefix with the imperative
`Execute the following scheduled task now: <task>` in all three injection sites
(agent loop, scheduler oneshot fallback, CustomTaskHandler fallback) to prevent
LLMs from interpreting the annotation as metadata and cancelling bash tasks
instead of executing them.

Introduce SCHEDULED_TASK_PREFIX constant in zeph-core to keep all sites in sync.
@bug-ops bug-ops force-pushed the fix-2073-scheduler-task-injection branch from 55c1eeb to 86fbbde Compare March 20, 2026 23:09
@bug-ops bug-ops enabled auto-merge (squash) March 20, 2026 23:09
@bug-ops bug-ops merged commit bc94547 into main Mar 20, 2026
29 checks passed
@bug-ops bug-ops deleted the fix-2073-scheduler-task-injection branch March 20, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/S Small PR (11-50 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(scheduler): task injection format is ambiguous — LLM cancels bash tasks instead of executing them

1 participant