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
Conversation
…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>
Contributor
Author
|
Folded the reviewer nit: the comment now points at the concrete in-repo source ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Setting up a Uni Weaver job surfaced that the
#agent/jobtag 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/threadpattern and declare the useful indexed query axes on the#agent/jobentry inAGENT_VAULT_TAG_SCHEMA:channelenabledenabled:"true") vs paused ("false")lastStatusAll string-typed (the vault stores metadata as strings;
enabledis"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_TAGis now exported (for the test).This is the durable way to get fields into the schema — a manual
update-tagwould be clobbered by the module's nextensureSchema()push.Tests
ensureSchema sends the indexed fields body for #agent/job(mirrors the thread-fields test).tsc --noEmitclean;bun test ./src1018 pass / 0 fail.Note: separate from the open #125 (orphan-poll-teardown) — different files (
transports/vault.tsvsagent-defs.ts), isolated on its own branch; no conflict.