Skip to content

feat(hub): add automated evaluation settings and screenshot consent - #391

Draft
nshki wants to merge 13 commits into
nshki/feat/hub/learning-mcpfrom
nshki/feat/hub/evaluation-settings
Draft

nshki wants to merge 13 commits into
nshki/feat/hub/learning-mcpfrom
nshki/feat/hub/evaluation-settings

Conversation

@nshki

@nshki nshki commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Why

Hub is about to check whether learnings actually help, and suggest updates when they don't. That work costs Copilot credits and, for UI prototypes, works best with screenshots from the agent. Neither should happen without someone choosing it. This adds the switches that let people opt in: a shared budget, a per-repository switch, and permission for agents to send screenshots.

What changes

The Learnings page gets an Automated evaluations button for people who administer Hub or the repository. It opens one settings page. Hub administrators set a monthly credit budget shared by all repositories. Repository administrators turn evaluations on for their repository and choose whether to allow screenshots. Hub and repository administration stay separate, so each person sees only the controls they own. Nothing runs evaluations yet; that comes in the next layer.

Allowing screenshots records a consent grant in the repository's learning store, with who allowed it. Hub passes that grant to every report_usage call from a connected agent, so the store accepts screenshots only while it is active. Hub keeps a copy of each accepted image only while the grant stands. Turning screenshots off, or turning evaluations off, withdraws the grant and queues a job that deletes those copies. The worker's regular recovery pass finds withdrawn grants again, so a failed queue or a copy saved mid-change is still cleaned up.

The learning package gains the grant check for hosted screenshots. Hub gains tables for the budget, per-repository settings, and stored screenshots. This replaces the two evaluation prototype pages with the real page.

sequenceDiagram
  participant R as Repository admin
  participant H as Hub
  participant S as Learning store
  participant A as Agent
  R->>H: Allow screenshots
  H->>S: Add consent grant
  A->>H: report_usage with screenshot
  H->>S: Record usage under the grant
  H->>H: Keep a copy
  R->>H: Turn screenshots off
  H->>S: Withdraw grant
  H->>H: Delete the kept copies
Loading

Needs design review:

  • Used credits show 0 until evaluations run in the next layer, which will also enforce the budget. A budget of 0 shows a notice but does not block turning evaluations on.
  • The two prototype pages are combined into one settings page.
  • Turning evaluations off also turns screenshots off.
  • Only denied changes write security audits. Successful changes are recorded on the settings themselves.
  • The settings page is visible to Hub administrators and repository administrators, not every member.
  • Hub saves the image after the store accepts the report. If consent is withdrawn in between, the recovery pass deletes the late copy.
  • Agent requests carrying screenshots may be up to 32 MB.
  • The evaluator renewal step from the plan is dropped.
  • Hub has no screenshot storage quota yet. Picking one (per repository, per month, or per grant) is open.
  • The usage report, including screenshot bytes, passes to the learning command through a private temporary file. A crash can leave that file behind. Sending it over stdin would avoid this but changes the command for every host.
  • Turning screenshots on or off changes the learning store and then the Hub row, without a recovery record. A failure leaves the old state showing, and turning the switch again repeats the change.
  • Hub does not delete learnings yet. When it does, hosted screenshot bytes will need their own cleanup, since the store's delete cannot remove them.

Storybook screenshots

Hub/Pages/Learnings/Evaluation settings/Hub And Repository Admin (light, 1280×800)

Settings for someone who administers Hub and the repository

Hub/Pages/Learnings/Evaluation settings/Repository Admin (light, 1280×800)

Settings for a repository administrator

Hub/Pages/Learnings/Evaluation settings/Hub Admin (light, 1280×800)

Settings for a Hub administrator

Hub/Pages/Learnings/Evaluation settings/Budget Reached (light, 1280×800)

Settings when the budget is used up

Hub/Pages/Learnings/Evaluation settings/Budget Not Set (light, 1280×800)

Settings before a budget is set

Hub/Pages/Learnings/Default (light, 1280×800)

Learnings page with the Automated evaluations button

nshki and others added 8 commits November 25, 2026 23:33
Hosted stores keep no screenshot bytes, so a host that saves them itself
needs the store to check that the repository allowed screenshots. Reports
may now carry base64 screenshot data and name the consent grant.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Hub needs a Hub-wide evaluation budget, a per-repository opt-in, the
repository's screenshot consent grant, and a record of each stored agent
screenshot so it can delete the bytes when consent ends.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
@nshki
nshki added this pull request to stack #367 November 26, 2026 07:48
@nshki
nshki requested an adaptive review from Copilot November 26, 2026 07:48

Copilot AI 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.

🟡 Changes recommended

Critical consent, retention, and authorization flaws can allow unauthorized screenshot storage, prevent cleanup after consent withdrawal, and permit budget changes from revoked sessions.

20 open issues
What changed in this PR

Adds opt-in settings and screenshot consent to Hub’s Learnings flow, preparing for automated evaluations without running them yet.

Changes:

  • Combines the prototype pages into one settings page with separate Hub and repository administrator controls.
  • Adds consent checks for hosted screenshot reports and storage for accepted images.
  • Adds database models, withdrawal cleanup jobs, tests, and documentation.
File Description
packages/​learning/​test/​cli.test.mjs Tests hosted screenshot consent.
packages/​learning/​src/​store.mjs Validates and records screenshot grants.
packages/​learning/​src/​screenshots.mjs Adds host-kept screenshot support.
packages/​learning/​src/​mcp.mjs Accepts base64 screenshot data.
packages/​learning/​src/​config.mjs Configures hosted screenshot handling.
packages/​learning/​src/​cli.mjs Reads screenshot data and grant arguments.
packages/​learning/​README.md Documents hosted screenshot reporting.
hub/​server/​workers/​configuration.ts Registers screenshot deletion work.
hub/​server/​workers/​configuration.test.ts Updates processor registration expectations.
hub/​server/​utils/​evaluation-setting-key/​index.ts Defines the shared settings key.
hub/​server/​routes/​index.ts Mounts evaluation settings endpoints.
hub/​server/​routes/​api/​security-audits/​present-security-audit/​index.ts Presents evaluation administration denials.
hub/​server/​routes/​api/​learnings/​types.ts Defines settings dependency contracts.
hub/​server/​routes/​api/​learnings/​index.test.ts Tests settings access denial.
hub/​server/​routes/​api/​learnings/​evaluations/​patch/​index.ts Handles repository settings changes.
hub/​server/​routes/​api/​learnings/​evaluations/​get/​index.ts Returns settings and permissions.
hub/​server/​routes/​api/​learnings/​evaluation-budget/​patch/​index.ts Handles shared budget changes.
hub/​server/​routes/​api/​learnings/​create-learnings-route-dependencies/​index.ts Coordinates settings, consent, and cleanup.
hub/​server/​routes/​api/​learnings/​create-learnings-route-dependencies/​evaluation-settings.db.test.ts Tests persisted settings and budget authority.
hub/​server/​routes/​agent-connections/​types.ts Adds optional screenshot storage.
hub/​server/​routes/​agent-connections/​index.ts Connects agent reports to screenshot storage.
hub/​server/​repositories/​security-audits/​parse-security-audit-event/​index.ts Recognizes evaluation denial events.
hub/​server/​repositories/​security-audits/​create-security-audit/​types.ts Types evaluation denial operations.
hub/​server/​repositories/​evaluation-settings/​update-evaluation-budget/​index.ts Saves the shared budget.
hub/​server/​repositories/​evaluation-settings/​save-repository-evaluation-setting/​index.ts Saves repository evaluation settings.
hub/​server/​repositories/​evaluation-settings/​initialize-evaluation-setting/​index.ts Initializes shared settings.
hub/​server/​repositories/​evaluation-settings/​get-repository-evaluation-setting/​index.ts Reads settings and consent attribution.
hub/​server/​repositories/​agent-screenshots/​list-grant-agent-screenshots/​index.ts Batches images for deletion.
hub/​server/​repositories/​agent-screenshots/​list-agent-screenshot-grants/​index.ts Finds retained images by grant.
hub/​server/​repositories/​agent-screenshots/​delete-agent-screenshot/​index.ts Removes screenshot tracking records.
hub/​server/​repositories/​agent-screenshots/​create-agent-screenshot/​index.ts Deduplicates screenshot records.
hub/​server/​index.ts Supplies artifact storage to agent routes.
hub/​server/​domains/​learning/​jobs/​delete-agent-screenshots.ts Defines deletion payloads and retries.
hub/​server/​domains/​learning/​delete-withdrawn-agent-screenshots/​index.ts Deletes images for inactive grants.
hub/​server/​domains/​learning/​create-learning-job-processors/​index.ts Adds deletion processing and recovery.
hub/​server/​domains/​learning/​create-learning-job-processors/​index.test.ts Updates recovery test dependencies.
hub/​server/​domains/​learning/​change-screenshot-consent/​index.ts Adds or withdraws learning-store consent.
hub/​server/​domains/​agent-connections/​save-agent-screenshot/​index.ts Persists image records and bytes.
hub/​server/​domains/​agent-connections/​create-learning-mcp-backend/​index.ts Applies consent to screenshot reports.
hub/​server/​domains/​agent-connections/​create-learning-mcp-backend/​index.test.ts Tests report consent and storage decisions.
hub/​server/​create-app/​index.ts Allows route-specific request size limits.
hub/​schema/​repository.prisma Links repositories to settings and images.
hub/​schema/​repository-evaluation-setting.prisma Models repository settings and consent attribution.
hub/​schema/​migrations/​20261224170000_evaluation_settings/​migration.sql Creates settings and screenshot tables.
hub/​schema/​membership.prisma Links members to consent changes.
hub/​schema/​evaluation-setting.prisma Models the shared credit budget.
hub/​schema/​agent-screenshot.prisma Models stored screenshot tracking.
hub/​docs/​learning-foundation.md Documents settings, consent, and cleanup.
hub/​client/​pages/​screenshot-consent-prototype/​types.ts Removes obsolete prototype types.
hub/​client/​pages/​screenshot-consent-prototype/​styles.css Removes obsolete prototype styles.
hub/​client/​pages/​screenshot-consent-prototype/​stories.tsx Removes replaced consent stories.
hub/​client/​pages/​screenshot-consent-prototype/​index.tsx Removes the standalone consent prototype.
hub/​client/​pages/​screenshot-consent-prototype/​index.test.tsx Removes replaced prototype tests.
hub/​client/​pages/​learnings-page/​types.ts Adds the evaluation settings link contract.
hub/​client/​pages/​learnings-page/​stories.tsx Shows the evaluation settings entry point.
hub/​client/​pages/​learnings-page/​index.tsx Adds the Automated evaluations button.
hub/​client/​pages/​evaluation-settings-prototype/​types.ts Removes obsolete evaluation prototype types.
hub/​client/​pages/​evaluation-settings-prototype/​index.tsx Removes the evaluation prototype page.
hub/​client/​pages/​evaluation-settings-prototype/​index.test.tsx Removes replaced prototype tests.
hub/​client/​pages/​evaluation-settings-page/​types.ts Defines combined settings page props.
hub/​client/​pages/​evaluation-settings-page/​styles.css Styles the combined settings page.
hub/​client/​pages/​evaluation-settings-page/​stories.tsx Shows administrator and budget states.
hub/​client/​pages/​evaluation-settings-page/​index.tsx Renders budget, evaluation, and consent controls.
hub/​client/​pages/​evaluation-settings-page/​index.test.tsx Tests screenshot control availability.
hub/​client/​application/​hub/​view-models/​settings-learnings/​index.ts Exposes settings navigation by authority.
hub/​client/​application/​hub/​routes/​product-routes.ts Registers the settings page route.
hub/​client/​application/​hub/​routes/​learning-evaluations/​index.tsx Loads settings and submits changes.
hub/​client/​application/​hub/​learnings-contracts/​types.ts Types the settings API response.
hub/​client/​application/​hub/​learnings-contracts/​index.ts Validates settings response data.

Review effort: Max (adaptive)

Comment thread packages/learning/src/store.mjs Resolved
Comment thread hub/server/workers/configuration.ts Resolved
nshki and others added 5 commits November 26, 2026 00:25
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
…sion

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants