You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(hub): store learnings in a dedicated database scoped by repository ID - #437
Hub needs to keep learnings safely for each repository before it can show them or share them with agents. Until now, Hub kept them in files next to each checkout, and they were tied to Hub's internal repository ID. This third of five stacked pull requests builds on the local learning mode in #434.
What changes
Hub can now keep learnings in their own PostgreSQL schema with a separate database login. That login can reach only the learning data, not the rest of Hub's database. Learnings are tied to the GitHub repository ID, so renaming a repository keeps its history. Existing installations keep using local SQLite files until an operator moves their history across with the package's import command.
flowchart LR
Hub[Hub server] -->|Hub login| HubDB[(Hub schema)]
Hub -->|learning login| LearnDB[(Learning schema)]
LearnDB --- Scope[Scoped by GitHub repository ID]
Loading
The Azure setup wizard creates the learning login and its Key Vault secret for new installations. For an existing installation, it creates the login but leaves SQLite selected, and the infrastructure guide walks through the one-time move. Hub CI now installs the learning runtime, and the local dev container creates the learning role.
Hub also saves a checkpoint of the review comments each decision-model run used. This stops a learning run that finishes at the same time from changing that input. When combining old and new history shows that some text was removed earlier, the Learnings page now tells admins which learnings to rebuild and which exports may still contain that text. The page now shows that message as Hub sends it, without its own prefix.
Adds optional PostgreSQL-backed learning storage to Hub, building on local learning mode while keeping existing installations on SQLite until their history is migrated.
Changes:
Scope learnings by GitHub repository ID and provision a separate learning database login through Azure and local setup.
Persist decision-review checkpoints and report incomplete training-withdrawal discovery.
Show migration redaction follow-ups and update CI, coverage, and operating guides.
File
Description
scripts/check-ci-workflows/index.ts
Requires learning runtime installation in Hub CI.
scripts/check-ci-workflows/index.test.ts
Covers the new workflow requirement.
infrastructure/README.md
Documents provisioning, secrets, and migration ordering.
…ry ID
Hub now keeps learnings in their own PostgreSQL database with a separate
login, scoped by GitHub repository ID so renames keep their history. Azure
installs provision the learning login and secret, Hub CI installs the
learning runtime, and decision review snapshots are fenced against
concurrent learning checkpoints.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 459b160c-a7ab-4c14-8a06-098ca9096352
A new repository scope writes through triggers that maintain the decision
tables, and deleting learnings needs DELETE. The grant script missed those,
so the restricted login could not open a fresh scope. It now matches the
package's documented runtime privileges, and a database test runs real
commands as that login.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 459b160c-a7ab-4c14-8a06-098ca9096352
Keep the focused database test aligned with the Hub formatter.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 459b160c-a7ab-4c14-8a06-098ca9096352
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The database-access test can overwrite an existing login’s password and fail in supported environments, while GitHub sync can incorrectly adopt the local walkthrough fixture.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Azure releases can lose existing learning history, while repository disconnection can prevent deletion of withdrawn private training data and derived runtime copies indefinitely.
No open issues 🎉
3 previously missed issues
In code that hasn't changed since last review
Allow maintenance deletion for withdrawals after repository disconnection
When a training withdrawal is discovered after repository disconnection, the empty administrator grants make this branch skip deletion, leaving exported private data and derived runtime copies retained indefinitely. Retries cannot progress without restoring administrator access, which processDecisionRuntimeDeletion() also requires. Add a narrowly scoped maintenance deletion path authorized by the recorded withdrawal and saved training jobs, rather than requiring restored repository access.
Require durable storage before releasing an existing Azure installation
infrastructure/azure/install/index.ts:265
[P1] For an existing Azure installation without learning_database_secret, this branch keeps SQLite selected but still releases the app after removing all old replicas. application.tf mounts no persistent learning storage, so any history on those replicas is lost. Block the release until that history is recovered and verified or persistent storage is provided; the manual first-install example at infrastructure/azure/installation.tfvars.example:15–20 must also select durable storage.
Declare redactionFollowUps on the public LearningStore interface
packages/learning/src/store.mjs:5324
The public LearningStore interface in packages/learning/index.d.mts does not declare this method, although createLearningStore() returns that interface. TypeScript consumers therefore cannot call the new lightweight follow-up lookup without a type error. Add a matching redactionFollowUps(context) declaration with its result type so the runtime API and shipped declarations stay aligned.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Hub needs to keep learnings safely for each repository before it can show them or share them with agents. Until now, Hub kept them in files next to each checkout, and they were tied to Hub's internal repository ID. This third of five stacked pull requests builds on the local learning mode in #434.
What changes
Hub can now keep learnings in their own PostgreSQL schema with a separate database login. That login can reach only the learning data, not the rest of Hub's database. Learnings are tied to the GitHub repository ID, so renaming a repository keeps its history. Existing installations keep using local SQLite files until an operator moves their history across with the package's import command.
The Azure setup wizard creates the learning login and its Key Vault secret for new installations. For an existing installation, it creates the login but leaves SQLite selected, and the infrastructure guide walks through the one-time move. Hub CI now installs the learning runtime, and the local dev container creates the learning role.
Hub also saves a checkpoint of the review comments each decision-model run used. This stops a learning run that finishes at the same time from changing that input. When combining old and new history shows that some text was removed earlier, the Learnings page now tells admins which learnings to rebuild and which exports may still contain that text. The page now shows that message as Hub sends it, without its own prefix.
Storybook screenshots
Hub/Pages/Learnings / Load Error - light theme, 1440x1000 CSS-pixel viewport (focused alert crop)