Skip to content

feat(roadmap): the alternatives check reads the brain digest - #7496

Merged
dan-petty merged 5 commits into
mainfrom
feat/4682-alternatives-check-reads-brain-digest
Nov 28, 2026
Merged

dan-petty merged 5 commits into
mainfrom
feat/4682-alternatives-check-reads-brain-digest

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The alternatives check of an item now reads the brain digest of the item before its one model call. The digest holds the near items of the entry of the item in the brain index of valkey-roadmap: the date of each check, its verdict, its tool and the ADRs in force that reject that tool, at most 2,000 tokens of whole entries. The request holds the digest as brain only when it has an entry, and the check makes no other model call. A written check records the used brain entries in alternatives.brain_used, in the same write as its block. The new setting roadmap.brain.digest (on by default) turns the read off. With no store, a store that does not answer, or an item with no entry, the digest is empty and the check runs as before.

A decision on one item did not reach the check of the next item, so near items got different tools, and tools that an ADR rejects.

Closes #4682

Change: openspec/changes/archive/2026-11-28-4682-alternatives-check-reads-brain-digest/

@dan-petty dan-petty added type/feature Type feature: a new function scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 28, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results of head 04e34ce0ec58 (local, devcontainer):

  • Test first: on the base, uv run pytest -n 4 tests/roadmap/test_brain_digest.py tests/config/test_brain_digest_setting.py tests/security/test_config_declarations.py tests/roadmap/test_roadmap_limit_classes.py gave 5 failed and 1 collection error (tests/roadmap/test_brain_digest.py imports the new module).
  • uv run devops ci fail-to-pass --base origin/main: exit 0. The changed tests that fail or error on the base: tests.roadmap.test_brain_digest, the 3 cases of tests.config.test_brain_digest_setting, test_every_numeric_limit_of_the_roadmap_jobs_has_a_class and test_the_variables_are_those_before_one_for_each_read_option_that_had_none_and_later_ones.
  • uv run devops ci test tests/roadmap tests/config tests/security tests/valkey tests/docs tests/invariants and the config command tests: 12630 passed, 1 skipped.
  • uv run devops ci --check --only lint,format,typecheck,docs,constructs,openspec,test-settings,test-tree,startup-imports,swallowed-failures: each row passes.
  • uv run mypy of the 8 changed source files: no issues.

Scenarios and their tests (tests/roadmap/test_brain_digest.py unless named):

  • Five near items: test_the_digest_holds_the_five_near_items_with_their_verdicts_and_tools
  • More entries than the cap: test_a_digest_over_2000_tokens_holds_whole_entries_of_at_most_2000_tokens
  • A dated verdict: test_the_digest_holds_the_date_of_the_check_of_each_near_item
  • A tool that an ADR rejects: test_the_digest_names_the_adr_in_force_that_rejects_the_tool_of_a_near_item
  • An area check: test_the_digest_holds_no_area_verdict_while_the_index_holds_no_area_check (the index has no kind of entry for an area check, so the area part gives nothing)
  • A digest and an empty digest: test_the_request_holds_the_brain_key_for_a_digest_and_none_for_an_empty_digest
  • One model call: test_a_check_with_a_digest_makes_as_many_model_calls_as_a_check_with_an_empty_digest
  • Valkey down, no URL, index not built: test_a_brain_that_is_not_available_gives_no_brain_key_and_the_check_of_today[valkey-down|no-roadmap-state-url|index-not-built]
  • The default and the off value: test_the_digest_switch_off_makes_no_brain_read, and tests/config/test_brain_digest_setting.py
  • Eleven entries: test_a_digest_of_eleven_entries_records_ten_used_entries_in_one_write
  • The nested capability: uv run devops openspec check passes, and git grep -c '^### Requirement:' openspec/specs/roadmap-alternatives/spec.md prints 80

Pending a person:

  • After the merge and the release, the alternatives row checks 3 items of the stage window as the App. A comment on feat(roadmap): the alternatives check reads the brain digest #4682 gives the result line of each item, the brain entries of each digest (alternatives.brain_used of its record) and, over 7 days, the lines of devops_cli_ai_tokens_total{row="alternatives"}. A digest of 5 entries holds about 360 tokens, and the request of each turn of a run holds it, so a run of 5 turns or more can rise by more than 1,500 prompt tokens.
  • Review the diff in tuicr (tuicr -r origin/main..HEAD).

@dan-petty

Copy link
Copy Markdown
Owner Author

Vetting of this pull request, 2026-11-28, head 04e34ce0e. No change needed.

Evidence:

  • The branch holds main. uv run devops ci test of the brain and alternatives tests (tests/roadmap -k "brain or alternatives", tests/config/test_brain_digest_setting.py): 516 passed. Each check of the head passes.
  • The diff matches feat(roadmap): the alternatives check reads the brain digest #4682: one request with brain only for a digest that has an entry, no extra model call, at most 2,000 tokens of whole entries, alternatives.brain_used in the same write as the block, and roadmap.brain.digest takes only on or off.
  • An independent review read the code paths from start to end and ran scratch scripts. The builder and the reader agree on the hash fields, the key shapes and the ids (item:<n>, tool:<16 hex>). A skip check and a check with an empty digest clear alternatives.brain_used, a failed check keeps it, and the plan mode writes nothing. A store that does not answer, a key of a wrong type and a closed breaker give an empty digest.
  • On a workstation with no roadmap.state.url, digest_index gives no index, so the check runs as before.

Found outside this change, filed:

The live proof of #4682 (3 items of the stage window as the App, and 7 days of devops_cli_ai_tokens_total{row="alternatives"}) stays a step after the merge and the release.

@dan-petty
dan-petty marked this pull request as ready for review November 28, 2026 01:37
@dan-petty
dan-petty merged commit 0a47a6d into main Nov 28, 2026
29 checks passed
@dan-petty
dan-petty deleted the feat/4682-alternatives-check-reads-brain-digest branch November 28, 2026 01:48
dan-petty-release Bot added a commit that referenced this pull request Nov 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.232.0](v0.231.1...v0.232.0)
(2026-11-28)


### Features

* **roadmap:** the alternatives check reads the brain digest
([#7496](#7496))
([0a47a6d](0a47a6d))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(roadmap): the alternatives check reads the brain digest

1 participant