Skip to content

docs: record enabled OpenCode quota summary timer - #12267

Merged
dezren39 merged 4 commits into
mainfrom
queue/9170-2232-schedule-pilot
Nov 22, 2026
Merged

dezren39 merged 4 commits into
mainfrom
queue/9170-2232-schedule-pilot

Conversation

@dezren39

@dezren39 dezren39 commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Track the OpenCode scheduled-job pilot in the repository: a per-job systemd service/timer, explicit route, fixed logs/history, a fail-closed input sanitizer, and a strict installer. The timer state is unchanged by default; --enable is the explicit opt-in.

systemd timer
  -> one-shot service (opencode-route/workhorse)
    -> sanitize quota snapshot
    -> opencode run
    -> latest.log + append-only history.jsonl

The quota-freshness summary is the single read-only pilot. The fleet registry records the same schedule.

Evidence

  • Before: The pilot scripts and units existed only in the laptop's ~/atlas directory; the PR contained registry documentation but not the reproducible package.
  • After: bash pm-stack/opencode-scheduled-jobs/test.sh — PASS (fake OpenCode invocation, explicit route, fixed log/history, sensitive-field omission, strict CLI rejection).
  • After: bash -n and git diff --check — PASS; rendered service/timer pass systemd-analyze --user verify (one unrelated existing pm-host-health.timer warning).
  • Live cadence: opencode-quota-freshness-summary.timer fired at 2026-11-21 20:00:58 CST and completed at 20:01:17 CST with systemd Result=success, exit 0. history.jsonl records run 20261122T020058Z, route opencode-route/workhorse; latest.log contains the summary.
  • Muse cost: The systemd trigger used 0 Muse tokens; the job execution used its selected OpenCode route. A comparable historical per-trigger Muse-token baseline is unavailable, so no numeric before/after delta is claimed. Evidence is recorded on investigate: OpenCode native scheduled tasks — creation, route choice, independence from Muse tokens #2019.

Merge Danger

Door: Two-way; disable the timer and restore the registry row to reverse the pilot.

Blast Radius: Narrow — one read-only hourly laptop job and its own logs.

Refs #2232.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 49e7afc0-37c1-45a7-a783-333d787a1138
Commits

Reviewing files that changed from the base of the PR and between d94de71 and 1b26b76.

Files selected for processing: 10

  • doc/fleet-schedule-registry.md
  • pm-stack/opencode-scheduled-jobs/README.md
  • pm-stack/opencode-scheduled-jobs/install-laptop.sh
  • pm-stack/opencode-scheduled-jobs/jobs.json
  • pm-stack/opencode-scheduled-jobs/quota-freshness-summary/prompt.md
  • pm-stack/opencode-scheduled-jobs/quota-freshness-summary/run.sh
  • pm-stack/opencode-scheduled-jobs/quota-freshness-summary/summarize.py
  • pm-stack/opencode-scheduled-jobs/systemd/user/opencode-quota-freshness-summary.service
  • pm-stack/opencode-scheduled-jobs/systemd/user/opencode-quota-freshness-summary.timer
  • pm-stack/opencode-scheduled-jobs/test.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T02:48:58.802622Z 1b26b76 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 546e925913

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2 to +5
set -Eeuo pipefail
umask 077

SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject undeclared arguments before starting the job

When an operator invokes this entry point with --dry-run, a typo, or a stray positional argument, the script ignores it and executes the full job, overwriting logs and invoking the configured OpenCode route. A temporary-fixture invocation of run.sh --dry-run confirmed that it exits successfully and invokes the fake OpenCode executable. Declare the no-argument contract and reject unexpected arguments before any subprocess or filesystem operation; AGENTS.md explicitly requires strict parsing before side effects.

AGENTS.md reference: AGENTS.md:L44-L47

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already addressed in 1b26b76 (the current head), which Codex reviewed with no findings: run.sh rejects any argument before touching the filesystem, the summary picks the newer of the embedded and standalone heartbeats, and lapsed is kept, counted and named in the prompt. test.sh passes.


Generated by Claude Code

Comment on lines +85 to +86
"gathererHealthy": heartbeat.get("ok") is True and not heartbeat.get("error"),
"gathererError": bool(heartbeat.get("error")),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Read the latest standalone heartbeat before reporting health

When a gatherer tick fails before collecting providers, failTick() in pm-stack/aggregator/scripts/gather-quota.ts writes an unhealthy standalone quota-gatherer-heartbeat.json but deliberately leaves quota-current.json unchanged. Reading only the embedded heartbeat therefore reports gathererHealthy: true and gathererError: false from the previous successful tick, even while the current gatherer is failing; the snapshot can also remain fresh within the 30-minute threshold. Read and validate the standalone heartbeat and select the newer record, as the existing latestQuotaHeartbeat() consumer does, before calculating these health fields.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already addressed in 1b26b76 (the current head), which Codex reviewed with no findings: run.sh rejects any argument before touching the filesystem, the summary picks the newer of the embedded and standalone heartbeats, and lapsed is kept, counted and named in the prompt. test.sh passes.


Generated by Claude Code

Comment on lines +67 to +69
"state": provider.get("state")
if provider.get("state") in ("ok", "error", "unconfigured")
else "unknown",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the supported lapsed provider state

When an OpenCode Go or Meta session expires, entryFromResult() in pm-stack/aggregator/src/quota-gather-map.ts deliberately emits state: "lapsed" rather than "error". This whitelist converts that valid failure state to "unknown", losing the information needed to identify the expired session. A newly measured lapsed row can be fresh and non-retained, so it also falls outside every problem category the prompt explicitly asks the model to name. Preserve lapsed in the report, count it separately, and include it among the prompt's reportable states.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already addressed in 1b26b76 (the current head), which Codex reviewed with no findings: run.sh rejects any argument before touching the filesystem, the summary picks the newer of the embedded and standalone heartbeats, and lapsed is kept, counted and named in the prompt. test.sh passes.


Generated by Claude Code

@dezren39

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 1b26b762f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dezren39
dezren39 merged commit 8e8c29f into main Nov 22, 2026
2 checks passed
@dezren39
dezren39 deleted the queue/9170-2232-schedule-pilot branch November 22, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant