Skip to content

docs(adr): Valkey keys are coordination keys or cache keys #5245

Open

Description

@dan-petty

Problem or Motivation

Child 9 of the ADR modernization (#5233). Decision (owner decision 6). It waits for the owner.

The review of each record that this item changes:

  • ADR 0021 (amend (Status History and two amending records)): The direction holds (owner, 2026-11-11), but only 2 of its 15 steps are built, and it grew from 3,585 to 7,472 words in 2 days. New rows go to their OpenSpec change and the step order to feat(roadmap): move Service work to Workflows and Valkey #4517. Caps become settings, cache keys fall back, and coordination keys fail closed.
  • ADR 0023 (amend (shared-state and limits records)): The built parts match (the pybreaker tier, the SBOM tools), and 9 of the 13 sub-issues are open. AOF and a backup replace the hidden-block copies if the owner agrees. The count caps become settings with RowMode plan, and the USD ceilings stay hard.

Proposed Solution & Architectural Design

A new record amends rules 1 and 9 of 0021 and section 3 of 0023. Coordination keys fail closed with exit 75, and cache keys fall back to the local tier. Derived insights rely on AOF and a k8up backup with one tested restore. A job leaves the Service pod only when its requests count in the shared budget. The router runs more than one replica only when it holds no volume and no state. No code changes: the plans of #4563-#4565, #4676 and #4687 change after it.

Owner decision 6 of 2026-11-12: Yes: Valkey AOF, a k8up backup and one tested restore, with no hidden blocks. Person decisions stay on GitHub.

Rules of the ADR process (docs/adr/README.md, #5225) that apply:

  • Use one form for a Status History line, 30 words at most: 'YYYY-MM-DD: Amended by ADR NNNN, section S | Amended by the owner decision in #N, section S | Superseded by ADR NNNN | Fact out of date: (#N) | Living detail moved to (#PR).' The PR that makes a fact of a record wrong adds the line (AGENTS.md rule 8). An agent never edits the body of an accepted record.
  • Supersession: the new record sets 'supersedes', and the same PR sets status and 'superseded-by' on the old record. The test fails on a link that goes only one way. The new record restates each rule and each rejected option that still holds, because the alternatives check drops superseded records. Never amend a superseded record. After a third amendment, or when a body contradicts the code, the next change is a supersession.
  • Length: the body of a new record has 1,000 words or fewer, its title has 10 words or fewer, and its slug has 60 characters or fewer. Designs, catalogues, row tables, cutover plans, caps and measurements go to OpenSpec changes and specs, to settings or to docs, with a link under More Information.
  • Use one Considered Options section. Each bullet ends with 'chosen.', 'rejected, because .' or 'deferred until .'. 'Deferred' does not match the rejected regex (adr.py:49), so the check stops refusing on a premise that changed. Each record has a Confirmation section that names its test, CI row or metric, and an optional tracker key.
  • Merge ADR changes in batches. Each change of the ADR set changes adr_hash (alternatives.py:634-644, 1006) and makes every checked item due again. So all pure status changes go in docs(adr): add MADR front matter, a Status History and the ADR rules #5225, and the record PRs merge one at a time in the planned order.
  • Keep the fix(roadmap): the ADRs in force fill the alternatives ADR budget #5049 budget test. A new record must fit in the tokens that the records it supersedes free. Short option bullets keep the budget, because options are 6,883 of the 8,464 tokens today.

Keep these constraints on purpose. The review found a reason for each one:

  • ADR 0003/0017/0021, the sweep is the source of truth and 'webhooks as the only trigger' stays rejected: 25 of 100 deliveries got 403, and about 116 s are lost at each rollout.
  • ADR 0021, coordination keys fail closed (shared request window, holds, identity halt, locks): a local fallback would let N pods pass the owner's cap.
  • ADR 0023/0025, USD ceilings and the caps on new issues: they stop an intake flood. No progress extension applies to weekly output counts.

The owner merges this pull request.

Target Subsystem

docs/adr/.

Existing Tool Considered

MADR 4 and the rules of docs/adr/README.md (#5225). No new tool.

Acceptance Criteria

Dependencies

Owner decision 6 of 2026-11-12 is made.

Related

Source: #5233

Alternatives check of 2026-11-16: not-applicable.
Class: docs, no search.
Tool: none found.

Proposed design

Problem statement

ADR 0021 and ADR 0023 do not state which Valkey keys fail closed and which keys fall back to the local tier. They also allow hidden-block copies for derived insights. The new ADR amends both records. It makes coordination keys fail closed with exit 75, cache keys fall back, and derived insights use AOF with a k8up backup and one tested restore. The change adds no code.

Acceptance criteria

Requirement: New ADR amends two records

The change SHALL add one accepted ADR that sets amends to 0021 and 0023 and amends ADR 0021 rules 1 and 9 and ADR 0023 section 3.

Scenario: ADR links and body hash

  • WHEN uv run devops ci test tests/invariants/test_adr_records.py runs
  • THEN The test exits 0 and reports no problem for the new record, ADR 0021 and ADR 0023.

Requirement: Amended records get status keys and history

The pull request SHALL set amended-by and one dated Status History line on ADR 0021 and ADR 0023.

Scenario: Amended links and index

  • WHEN uv run devops docs check and uv run devops ci test tests/invariants/test_adr_records.py run
  • THEN Both commands exit 0 and the index shows the new record as an amendment of ADR 0021 and ADR 0023.

Requirement: Coordination keys fail closed and cache keys fall back

The new ADR SHALL state that Valkey coordination keys fail closed with exit 75 and that cache keys fall back to the local tier.

Scenario: Key behavior is in the new record

  • WHEN grep -n 'coordination keys fail closed with exit 75' docs/adr/*.md and grep -n 'cache keys fall back to the local tier' docs/adr/*.md run
  • THEN Both commands exit 0 and each prints a line from the new ADR.

Requirement: Derived insights use AOF and a tested restore

The new ADR SHALL state that derived insights use Valkey AOF and a k8up backup with one tested restore, that the change builds no hidden-block format, and that one tested restore is a precondition for brain-weekly in mode on.

Scenario: Backup and restore rule

  • WHEN grep -n 'Valkey AOF' docs/adr/*.md, grep -n 'k8up backup with one tested restore' docs/adr/*.md, grep -n 'hidden-block format' docs/adr/*.md and grep -n 'precondition for brain-weekly' docs/adr/*.md run
  • THEN All commands exit 0 and each prints a line from the new ADR.

Requirement: Job placement and router replicas

The new ADR SHALL state that a job leaves the Service pod only when its requests count in the shared budget, and that the router runs more than one replica only when it holds no volume and no state.

Scenario: Job placement and router replica rules

  • WHEN grep -n 'requests count in the shared budget' docs/adr/*.md and grep -n 'no volume and no state' docs/adr/*.md run
  • THEN Both commands exit 0 and each prints a line from the new ADR.

Requirement: Limits stay hard and count caps become settings

The new ADR SHALL state that the USD ceilings and the caps on new issues stay hard, and that count caps become settings with RowMode plan.

Scenario: Limits rule

  • WHEN grep -n 'USD ceilings' docs/adr/*.md and grep -n 'RowMode plan' docs/adr/*.md run
  • THEN Both commands exit 0 and each prints a line from the new ADR.

Requirement: Plan issues get a comment

The change SHALL add one comment to #4563, #4564, #4565, #4676 and #4687 that names the plan change.

Scenario: Plan issues get a comment

Requirement: The pull request changes no code

The pull request MUST change no file under src/, tests/ or .github/.

Scenario: No code files change

  • WHEN git diff --name-only origin/main...HEAD runs
  • THEN The output lists no file under src/, tests/ or .github/.

Requirement: ADR checks and budget pass

The change MUST pass the ADR invariant test, the docs index check and the #5049 budget test.

Scenario: ADR checks pass

Requirement: Pending a person after the merge

The owner MUST merge the ADR pull request after the checks pass.

Scenario: Owner merges the pull request

  • WHEN The ADR pull request is ready and every required check passes
  • THEN The owner merges the pull request and the new record is accepted on main.

Existing Tool Considered

The alternatives check of 2026-11-16 in the issue body records not-applicable for class docs and names no tool. No open, maintained tool covers the ADR content. MADR 4 supplies the record template only. The change adds no code, so it has no build cost.

Key questions

  • Should the change amend ADR 0021 and ADR 0023 with a new record, or supersede them?: Add one new ADR with amends set to 0021 and 0023. Neither record has reached its third amendment. Their bodies match the code. (best practice) [sources: docs/adr/README.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md]
    • Chosen: Amend both records with one new ADR. The README allows an amendment before the third one, and the bodies match the code.
    • Rejected: Supersede both records. The README reserves supersession for a third amendment or a body that contradicts the code.
    • Rejected: Edit the accepted bodies in place. The body hash test fails, and an agent never edits an accepted body.
  • Which Valkey keys are coordination keys?: The coordination keys are the shared request window, the holds, the identity halt and the locks. [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
  • Which Valkey keys fail closed, and which keys fall back to the local tier?: Coordination keys fail closed with exit 75. Cache keys fall back to the local tier. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md, CONTEXT.md]
    • Chosen: Coordination keys fail closed; cache keys fall back. A local fallback for a coordination key would let N pods pass the owner's cap; a cache can use the local tier.
    • Rejected: All keys fail closed. A cache miss would stop a job that can use the local tier.
    • Rejected: All keys fall back. It breaks the shared request window, holds, identity halt and locks.
  • What does owner decision 6 of 2026-11-12 decide for derived insights?: It adopts Valkey AOF, a k8up backup and one tested restore. It removes hidden-block copies. (best practice) [sources: docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md, docs/adr/0025-generated-documents-stay-in-git-and-the-project-brain-cites-them.md]
    • Chosen: Adopt Valkey AOF, a k8up backup and one tested restore. Owner decision 6 adopts it and removes hidden-block copies.
    • Rejected: Keep hidden-block copies. Owner decision 6 removes them.
  • Does the record keep the USD ceilings and the caps on new issues hard?: Yes. The USD ceilings and the caps on new issues stay hard. Count caps become settings with RowMode plan. (best practice) [sources: docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md, docs/adr/0025-generated-documents-stay-in-git-and-the-project-brain-cites-them.md]
    • Chosen: Keep USD ceilings and issue caps hard; make count caps settings. They stop an intake flood, and no progress extension applies to weekly output counts.
    • Rejected: Make all caps settings. It removes the hard limit that stops an intake flood.
  • What rule does the record set for job placement and router replicas?: A job leaves the Service pod only when its requests count in the shared budget. The router runs more than one replica only when it holds no volume and no state. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
    • Chosen: State both rules. The body states both conditions, and ADR 0021 section 1 gives the router two replicas with no volume.
    • Rejected: State job placement only. It leaves the router replica condition unstated.
    • Rejected: State router replicas only. It leaves the job budget condition unstated.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#5243

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/docs
    status/new
    value/medium
    effort/low
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
    • Scope: none. The title has the scope adr, and .github/labels.yml declares no scope/adr label. Add the label to the file to give the scope to this item.
    • Related: feat(roadmap): keep plan records and record locks in Valkey #4564, which asks for a different change. Both concern Valkey keys for the roadmap, but the candidate writes the ADR decision (coordination keys fail closed, cache keys fall back) while #4564 implements storing plan records and locks in Valkey.
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor

    The approved roadmap pipeline split (tracker #5482) removes every due mark. #5502 waits for this item. After this item merges, #5502 removes "a due mark" from the Valkey key classes and from the list of what moves to valkey-roadmap. Do not add a due mark as a key class in this record, so the two records do not change the same text in two ways.

  6. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Alternatives check: not-applicable

    Class: docs. The check makes no search and no model call for an item of this class.

    Tool: none found

    Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.

  7. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Owner question: Who merges the ADR pull request? (a person decides)

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  8. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  9. dan-petty commented on Nov 24, 2026

    @dan-petty
    OwnerAuthor

    The owner merges the pull request. Only a person merges pull requests (AGENTS.md).

  10. devops-cli-service commented on Nov 24, 2026

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  11. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

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

    effort/lowpriority/p2-mediumsource/agentstatus/newtype/docsvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions