Skip to content

Scheduled jobs cannot see the agent's workspace — no checkout, no ox code index #30

Description

@shrimalmadhur

Summary

An agent's chat surface gets a persistent workspace — the repos.conf checkouts and the ox code index that repos.ts builds, kept warm across restarts on the agent's PVC. An agent's scheduled jobs (jobs[]) get an emptyDir.

So the surface doing the long-running, autonomous work has the least context, while the interactive surface has the most. A job body cannot use ox code search at all, and ox agent prime resolves against a bare directory instead of a real checkout.

Why a job can't just build its own

It isn't affordable. Measured on a large monorepo agent:

checkout ~440 MB
ox code index ~1.8 GB
cold ox index code ~10 minutes

A typical scheduled lane runs on a budget of tens of minutes and spends most of it on the actual task, so a cold index does not fit — and re-cloning + re-indexing per tick would burn far more than the work itself. Meanwhile the Deployment beside it has already paid that cost and is maintaining the index incrementally.

Proposal

Let a job body mount the agent's own persistence claim, read-only.

jobs:
  - slug: nightly
    run:
      workspace: read-only   # sees the agent's checkouts + ox index

The agent already pays for the volume; the job just reads it. No second copy, no cold start, no new storage class.

The wrinkle worth designing for: the chart's PVC is ReadWriteOnce, so the job pod has to land on the same node as the agent Deployment. RWO permits multiple pods per node, so pod affinity to the Deployment is enough — but that belongs in the chart rather than in every consumer's values file, and it needs a defined behaviour when the agent pod is absent or rescheduling (fail the job? run without the workspace and say so?).

Alternatives considered

Why not
A separate PVC per job Duplicates GBs per agent and still starts cold — the index is the expensive part, not the disk
RWX (e.g. EFS) for the shared volume New storage class, and a file-based search index on a network filesystem is a poor fit
Server-side only — accept that jobs never search code Workable for semantic search (ox query is API-backed and needs no local state), but ox code is a local index by design, so this drops code search from jobs permanently

Related

There's a smaller adjacent bug this uncovered, worth its own fix: ox agent prime exits 1 with must be run from within a coding agent unless --agent <name> (or a recognised AGENT_ENV) is passed. A runner that shells out to prime without it gets 0 bytes and no error it distinguishes from "nothing to report", so the whole standing-context section is lost silently. Documenting the flag as required for non-interactive callers — or making the failure louder — would save the next person the same hunt.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions