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

feat(agent): declare #agent/job schema fields (channel/enabled/lastStatus indexed) - #126

Merged
unforced merged 2 commits into
mainfrom
ag-agent-job-fields
Jun 22, 2026
Merged

feat(agent): declare #agent/job schema fields (channel/enabled/lastStatus indexed)#126
unforced merged 2 commits into
mainfrom
ag-agent-job-fields

Conversation

@unforced

Copy link
Copy Markdown
Contributor

Why

Setting up a Uni Weaver job surfaced that the #agent/job tag auto-creates but has no field schema (fields: null) — so a scheduled job's metadata wasn't first-class or queryable, and there was no schema-level hint about what a job note looks like. (The auto-create itself works — the tag re-declares on every agent registration.)

Change

Mirror the existing #agent/thread pattern and declare the useful indexed query axes on the #agent/job entry in AGENT_VAULT_TAG_SCHEMA:

field enables
channel "all jobs targeting agent X"
enabled active jobs (enabled:"true") vs paused ("false")
lastStatus jobs whose last run errored

All string-typed (the vault stores metadata as strings; enabled is "true"/"false"). The vault's field schema is permissive, so the other job fields (jobId/cron/tz/createdAt/lastRunAt) keep riding as undeclared metadata — the full field set + usage lives in the runner design doc and an in-vault reference note. AGENT_JOB_TAG is now exported (for the test).

This is the durable way to get fields into the schema — a manual update-tag would be clobbered by the module's next ensureSchema() push.

Tests

  • New: ensureSchema sends the indexed fields body for #agent/job (mirrors the thread-fields test).
  • Gate: tsc --noEmit clean; bun test ./src 1018 pass / 0 fail.

Note: separate from the open #125 (orphan-poll-teardown) — different files (transports/vault.ts vs agent-defs.ts), isolated on its own branch; no conflict.

unforced and others added 2 commits June 20, 2026 09:53
…atus indexed)

The module auto-declares the #agent/job tag (name + parent + description) but with
NO field schema, so a scheduled job's metadata had no first-class, queryable shape —
an operator/agent listing tags saw `fields: null` and couldn't tell how to query jobs
(and the runner's own list is tag-only). Mirror the #agent/thread pattern: declare the
useful indexed query axes on #agent/job so jobs become operator-queryable:

  - channel    → "all jobs targeting agent X"
  - enabled    → active jobs (enabled:"true") vs paused ("false")
  - lastStatus → jobs whose last run errored

All string-typed (the vault stores metadata as strings; `enabled` is "true"/"false").
The vault field schema is permissive, so the remaining job fields (jobId/cron/tz/
createdAt/lastRunAt) ride as undeclared metadata — full field set + usage lives in the
runner design doc and the in-vault reference note. Exported AGENT_JOB_TAG for the test.

Gate: typecheck clean; `bun test ./src` 1018 pass / 0 fail (new: ensureSchema sends the
#agent/job fields body).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…d breadcrumb)

Reviewer nit (#126, non-blocking): the comment referenced 'the in-vault reference
note' with no link. Point it at the concrete in-repo source instead — JobNoteMetadata
in src/jobs.ts + the runner design doc.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@unforced

Copy link
Copy Markdown
Contributor Author

Folded the reviewer nit: the comment now points at the concrete in-repo source (JobNoteMetadata in src/jobs.ts + the runner design doc) instead of a vague 'in-vault reference note' breadcrumb. Comment-only change; gate unchanged (1018 pass).

@unforced
unforced merged commit 81eaf04 into main Jun 22, 2026
@unforced
unforced deleted the ag-agent-job-fields branch June 22, 2026 04:35
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