Skip to content

feat(agent): AgentRunner primitives for prepare-then-cancel reloads - #105

Merged
gusfcarvalho merged 1 commit into
lisa/agent-config-04-instance-idfrom
lisa/agent-config-05-runner-reload-primitives
Oct 6, 2026
Merged

gusfcarvalho merged 1 commit into
lisa/agent-config-04-instance-idfrom
lisa/agent-config-05-runner-reload-primitives

Conversation

@ccf-lisa

@ccf-lisa ccf-lisa Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Part 5/11 of the split of #95 (agent remote configuration) into a stack. Review it as the diff against its base branch.

The building blocks the reconciler in the next PR drives:

  • Prefetch downloads every plugin and policy source of a candidate config
    and resolves plugin protocols without touching the running config's
    locations, so a download failure never tears a working agent down (R32).
    ReportStartupFailure keeps main's startup-failure behaviour (plugins
    marked failed, startup-failure agent evidence) for a failed prefetch.
  • Plugin protocol versions read from OCI annotations are cached per source
    and survive reloads, so a registry outage cannot turn a v2 plugin into v1.
  • runDaemon returns setup errors instead of exiting. On a reload, in-flight
    plugin runs drain for up to 5 minutes (R33); a SIGINT/SIGTERM during the
    drain still exits within 30s. Each cron job runs with the config, client
    and logger of its own setup.
  • UpdateConfig reuses the SDK client when the api block is unchanged, so
    its token cache survives reloads.
  • Plugins get the host environment minus CCF_API_AUTH_* (R26).
  • make test runs with -race.

The agent still uses the old reload loop here; #106 replaces it with the reconciler that drives Prefetch. Tests live in cmd/reconciler_test.go (filled in by #106).

Size: 489 lines changed (go.mod/go.sum excluded). Builds, vets, is gofmt-clean and passes go test -race ./... on its own; the top of the stack is byte-identical to #95 merged with main.

Stack
  1. test: pin agent configuration hashes and evidence seeds #101 test: pin agent configuration hashes and evidence seeds
  2. feat(runner): policy source from the _policy_path label; extra evidence props #102 feat(runner): policy source from the _policy_path label; extra evidence props
  3. refactor(config): adopt api/pkg/agentconfig as the declared config #103 refactor(config): adopt api/pkg/agentconfig as the declared config
  4. feat(agent): stable instance ID and per-instance state directory #104 feat(agent): stable instance ID and per-instance state directory
  5. 👉 feat(agent): AgentRunner primitives for prepare-then-cancel reloads #105 feat(agent): AgentRunner primitives for prepare-then-cancel reloads
  6. feat(agent): prepare-then-cancel config file reloads #106 feat(agent): prepare-then-cancel config file reloads
  7. feat(pluginlib): read the agent library version a plugin binary was built with #107 feat(pluginlib): read the agent library version a plugin binary was built with
  8. feat(agent): report the configuration to the API (remote_config off/report) #108 feat(agent): report the configuration to the API (remote_config off/report)
  9. feat(agentstate): persisted cache for the remote configuration overlay #109 feat(agentstate): persisted cache for the remote configuration overlay
  10. feat(agent): pull and apply remote configuration overlays (apply_safe/apply_all) #110 feat(agent): pull and apply remote configuration overlays (apply_safe/apply_all)
  11. feat(config): ${env:NAME} placeholders in plugin config; ADR 0003 #111 feat(config): ${env:NAME} placeholders in plugin config; ADR 0003

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 0a04d40c-809b-4537-b2e8-c3061991a2f4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

@gusfcarvalho gusfcarvalho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ccf-review: APPROVE

no findings.

Stack (gh stack 112): #101 → #102 → #103 → #104 → #105 → #106 → #107 → #108 → #109 → #110 → #111

@ccf-lisa
ccf-lisa Bot force-pushed the lisa/agent-config-05-runner-reload-primitives branch from 2a76a15 to f5dd098 Compare October 6, 2026 10:27
@ccf-lisa

ccf-lisa Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

PR approved. Marking ready for e2e.

The building blocks the reconciler in the next PR drives:

- Prefetch downloads every plugin and policy source of a candidate config
  and resolves plugin protocols without touching the running config's
  locations, so a download failure never tears a working agent down (R32).
  ReportStartupFailure keeps main's startup-failure behaviour (plugins
  marked failed, startup-failure agent evidence) for a failed prefetch.
- Plugin protocol versions read from OCI annotations are cached per source
  and survive reloads, so a registry outage cannot turn a v2 plugin into v1.
- runDaemon returns setup errors instead of exiting. On a reload, in-flight
  plugin runs drain for up to 5 minutes (R33); a SIGINT/SIGTERM during the
  drain still exits within 30s. Each cron job runs with the config, client
  and logger of its own setup.
- UpdateConfig reuses the SDK client when the api block is unchanged, so
  its token cache survives reloads.
- Plugins get the host environment minus CCF_API_AUTH_* (R26).
- make test runs with -race.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ccf-lisa
ccf-lisa Bot force-pushed the lisa/agent-config-05-runner-reload-primitives branch from f5dd098 to 659f6d2 Compare October 6, 2026 15:59
@gusfcarvalho
gusfcarvalho merged commit 4552770 into main Oct 6, 2026
9 checks passed
@gusfcarvalho
gusfcarvalho deleted the lisa/agent-config-05-runner-reload-primitives branch October 6, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant