镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

DOC-7268 Add a read-only Repo Memory query action - #4479

Open
andy-stark-redis wants to merge 2 commits into
mainfrom
DOC-7268-repo-memory-query-action
Open

andy-stark-redis wants to merge 2 commits into
mainfrom
DOC-7268-repo-memory-query-action

Conversation

@andy-stark-redis

@andy-stark-redis andy-stark-redis commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Jira: DOC-7268

Adds a local, read-only action that searches the Repo Memory store from a description of planned work, before any PR exists. It returns related PRs, commits and issues with the full squash or commit message behind each.

Why a separate local action

redis-learn/redis-repo-memory is on the GitHub Marketplace and a query mode is experimental, so the public action stays unchanged until the feature proves useful. This replaces redis-learn/redis-repo-memory#4, which I'll close.

What it does

  • .github/actions/repo-memory-query/: composite action with one script, query.js. It uses the same MEMORY_REDIS_URL and OPENAI_API_KEY secrets and the same repo_memory_idx index as the memory action.
  • .github/workflows/repo-memory-query.yml: workflow_dispatch entry point (gh workflow run repo-memory-query.yml -f query=... -f files=...). It does a sparse checkout of the action directory.
  • Read-only: never creates the index, writes a key, or posts to a PR or commit. Results are limited to this repository.
  • Prints one REPO_MEMORY_QUERY_RESULT_JSON log line and a step-summary list.
  • package-lock.json is force-added because the repo ignores lockfiles and the action installs with npm ci.

Tested

test.js runs offline against Redis 8.10 with a mock embedding: missing index, nearest-first order, limit and distance, other-repo exclusion, nothing written, empty inputs. Five deliberate breakages are each caught.

Not tested

  • A real Actions run (the github.token default, sparse checkout, input wiring).
  • Real OpenAI embeddings and retrieval quality from a plan.

The workflow can only be dispatched once this is on main, so the first real run happens after merge. Run logs are public, so the query text is too; the README says so.

🤖 Generated with Claude Code


Note

Low Risk
New opt-in CI tooling under .github/ only; read-only Redis access and no changes to application code or the existing memory writer.

Overview
Adds a local composite action and workflow_dispatch workflow so contributors can search the existing Redis Repo Memory index from a description of planned work (and optional file paths) before opening a PR, without changing the marketplace redis-learn/redis-repo-memory writer.

query.js embeds the plan with text-embedding-3-small, runs a read-only RediSearch KNN query on repo_memory_idx scoped to GITHUB_REPOSITORY, applies limit/distance filters, optionally hydrates full squash/commit/issue text via the GitHub API, and emits a REPO_MEMORY_QUERY_RESULT_JSON log line plus a step summary. It never creates the index, writes Redis keys, or posts comments.

repo-memory-query.yml wires the same MEMORY_REDIS_URL and OPENAI_API_KEY secrets as repo-memory.yml, with sparse checkout of the action folder. test.js exercises the script offline against empty Redis 8 using mock embeddings (repo filter, limits, read-only guarantees). package-lock.json is added so npm ci works despite repo lockfile ignores.

Reviewed by Cursor Bugbot for commit 2809ac3. Bugbot is set up for automated code reviews on this repo. Configure here.

A local composite action, .github/actions/repo-memory-query/, plus a
workflow_dispatch workflow, that searches the Repo Memory store from a
description of planned work before any PR exists. It returns related PRs,
commits and issues with the full squash or commit message behind each.

Why a separate action: redis-learn/redis-repo-memory is on the GitHub
Marketplace and the query feature is experimental. The team asked to keep the
public action unchanged until the feature proves useful, so the query logic
(first proposed as redis-learn/redis-repo-memory PR #4) lives here instead.

Design:
- Read-only. It never creates the index, writes a key, or posts to a PR or
  commit. It uses the same MEMORY_REDIS_URL and OPENAI_API_KEY secrets.
- Compatible with what the memory action writes: repo_memory_idx, memory:
  hashes, a cosine embedding from text-embedding-3-small. The embedded text has
  the same shape (title, body, file list, cut to 4000 characters).
- Results are limited to the repository the workflow runs in.
- Full text is read at the source because stored summaries stop at 500
  characters: the squash commit for a merged PR, the commit message for a push,
  the body otherwise. It falls back silently to the stored summary.
- The result is one REPO_MEMORY_QUERY_RESULT_JSON log line, so
  build/repo-memory-eval/recall/recall.py can parse it.

Tested offline with test.js against Redis 8.10 and a mock embedding. The first
version of the test let two mutants survive (reversed sort, a stray write on the
missing-index path), so it now asserts nearest-first order and an empty keyspace
after the missing-index query. Five mutants are caught.

Not verified: a real Actions run (github.token default, sparse checkout, input
wiring), real OpenAI embeddings, and retrieval quality from a plan.
Workflow logs of this public repo are public; the README says so.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f1c8eda. Configure here.

Comment thread .github/workflows/repo-memory-query.yml Resolved
Bugbot found two real problems on #4479.

The KNN search ran over the whole index and filtered by repository in JS, so
other repositories' items could use up the neighbors, and FT.SEARCH returns
only 10 rows by default, which silently capped any query-limit above 5. The
search now filters on the repo TAG first (escaping the "/" and "-" in a repo
name) and sets LIMIT to the neighbor count.

The workflow granted only contents: read, so the token could not be relied on
to read PR and issue text. My first draft had pull-requests: read and I dropped
it when rewriting the workflow. It now grants pull-requests: read and
issues: read. Whether GitHub serves public PRs to a token without that scope is
unverified; the grant removes the question. A failed lookup now logs its HTTP
status instead of silently dropping the full text.

Tests: added a case with 12 other-repo items that match the query better than
the in-repo item, and a query-limit of 13. My first crowding test was wrong
(the in-repo item was the exact match, so nothing was crowded out); it now
fails when the repo filter, LIMIT, or tag escaping is removed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

DOC-7268

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Redis Memory

Found 6 related items from repository history (1 new this commit):

Memory updated at 2809ac3

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