Skip to content

🤖 feat: secrets management in Settings → Projects#2139

Open
ammar-agent wants to merge 26 commits intomainfrom
secrets-v4jd
Open

🤖 feat: secrets management in Settings → Projects#2139
ammar-agent wants to merge 26 commits intomainfrom
secrets-v4jd

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Feb 3, 2026

Summary

Moves secrets management from a standalone modal into the Settings → Projects section, keeping all project-level configuration in one place. The sidebar project icons have been updated to use a Settings gear icon that opens the full project settings page.

Background

The original implementation added a separate SecretsModal opened via a key icon on each project header. This worked but meant project secrets were separate from other project settings (like MCP servers). Consolidating into Settings → Projects provides a more consistent UX.

Implementation

  • New ProjectSecretsSection component: Inline secrets editor with Add/Import/Save/Discard functionality
  • Integrated into ProjectSettingsSection: Added as a new section between the project selector and MCP Servers
  • Updated ProjectSidebar: Settings icon (was key icon) now opens Settings → Projects via openProjectSettings()
  • Removed SecretsModal: No longer needed

Key behaviors preserved:

  • Import from other projects (doesn't overwrite existing keys)
  • Auto-capitalize keys
  • Show/hide secret values
  • Save with validation (empty secrets filtered)

New behaviors:

  • Save/Discard buttons appear only when there are unsaved changes
  • Secrets load when switching projects in the dropdown
  • Warning prompt when switching projects with unsaved changes
  • MCP section's known secret keys update immediately after saving

Race condition fixes (Codex feedback):

  • Use useLayoutEffect for ref update to avoid stale import writes
  • Guard against empty projectPath during initial Settings render
  • Cancel stale imports when project changes
  • Reset isImporting state when project changes
  • Prompt for unsaved changes when deep-linking to project

Validation

  • Updated UI integration test to work with new Settings → Projects flow
  • Updated story: SecretsModalWithImportProjectSettingsWithSecrets
  • make static-check passes
  • Test passes: TEST_INTEGRATION=1 bun x jest tests/ui/secretsImport.integration.test.ts
  • Codex approved after addressing all review comments

Generated with mux • Model: anthropic:claude-opus-4-5 • Thinking: high • Cost: $15.53

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d9760618e4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30646883f9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ebb7311056

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent ammar-agent changed the title 🤖 feat: import secrets from another project via modal 🤖 feat: secrets management in Settings → Projects Feb 3, 2026
@ammar-agent
Copy link
Collaborator Author

@codex review

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed the previous race condition comment - the new ProjectSecretsSection now uses a ref to track the current project and cancels stale imports if the project changes during the async fetch.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da82e2fe2a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

1 similar comment
@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ad4aa6cc9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1faf0aca4e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

1 similar comment
@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 945c2a37f0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bcab0eb50a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 380967f25e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5620739b26

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Nice work!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

- Add 'Import from...' dropdown in the secrets modal that lists other projects
- Fetch and merge secrets from selected source project
- Skip existing keys (by uppercase comparison) to avoid overwriting
- Add UI test to verify import behavior and key preservation
Address Codex review comment: use setSecrets((current) => ...) to avoid
race conditions when user edits secrets while import is in-flight.

Also improve test consistency:
- Use setupTestDom() helper
- Keep import './dom' for Radix bootstrap side effects
- Move 'Import from...' dropdown above the secrets list for better visibility
- Add SecretsModalWithImport story to capture the feature visually
- Story sets up two projects with secrets and opens the modal via play function
Address Codex review: prevent race where user clicks Save before import
completes, which would close modal without persisting imported secrets.
- Create new ProjectSecretsSection component for inline secrets editing
- Integrate secrets UI into ProjectSettingsSection with proper heading
- Remove standalone SecretsModal component
- Update ProjectSidebar key icon to open Settings → Projects (via openProjectSettings)
- Tooltip changed from 'Manage secrets' to 'Project settings'
- Update story: SecretsModalWithImport → ProjectSettingsWithSecrets
- Update UI test to work with Settings modal flow

The secrets UI now lives in Settings → Projects, keeping all project-level
configuration in one place. Import from other projects still works the same way.
Add ref tracking to handleImportFromProject to discard results
if the user switches projects while an import is in flight.
Addresses Codex review comment about race condition.
- Replace KeyRound with Settings icon
- Update aria-label from 'Manage secrets for X' to 'Settings for X'
- Use standard hover colors instead of yellow
- Update test and story selectors
The :has-text pseudo-class is Playwright-specific and throws in happy-dom.
Add onSecretsChanged callback to notify parent when secrets are saved,
so MCP section's secret key validation reflects new keys immediately.
Ensures the ref is updated synchronously before any state updates
in the same render cycle when project changes.
Return early when projectPath is empty to avoid:
- Loading secrets for empty path during initial Settings render
- Saving secrets to empty path if user somehow triggers save
Add confirmation prompt when user tries to switch projects in dropdown
while secrets have unsaved changes, preventing accidental data loss.
When clicking sidebar settings button while modal is open, use
handleProjectChange to trigger the confirmation prompt.
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.

1 participant