Skip to main content

run_worker

Function run_worker 

Source
pub async fn run_worker(
    backend: &dyn AgentBackend,
    log: &mut EventLog,
    paths: &MissionPaths,
    cfg: &MissionConfig,
    feature: &Feature,
    plan_goal: &str,
    milestone_title: &str,
    extra_guidance: Option<&str>,
    cancel: Option<Arc<Notify>>,
    base_sha: Option<&str>,
    grants: &[String],
    egress_grants: &[String],
    deny_exceptions: &[String],
    auth_verdict: AuthVerdict,
    touch_set: &[String],
    executor_route: Option<ExecutorRoute>,
    standards_pin: Option<&StandardsPin>,
) -> Result<RunOutcome>
Expand description

Run one worker session for a feature (plan §4.6).

The rendered role prompt goes to append_system_prompt; the single-shot prompt is a short task statement (feature id/title/spec/criteria/guidance) so the role text and the task stay separable in transcripts.

The worker session’s cwd is the mission repo root (paths.repo_root). For M3 parallel-within-milestone execution — where each worker runs in its own git worktree — use run_worker_in to override just the session cwd while the run’s transcript and events stay under the real mission dir.

auth_verdict is the worker-HOME auth-preflight decision input (mission m-165b6f, f-1-2): AuthVerdict::Authenticated relocates HOME/ CLAUDE_CONFIG_DIR to a verified scratch env, anything else is a loud fail-safe that inherits the real HOME. Real per-spawn preflight + caching (computing this via crate::auth_verify::verify_worker_auth against backend) is not yet wired here — that is the next milestone; today callers pass the decision they already have.