Skip to content

feat(config): isolate agent config directory, support hot reloading and plaintext key display - #50

Merged
YoungSx merged 1 commit into
mainfrom
refactor/config-isolation-hot-reload
Oct 16, 2026
Merged

YoungSx merged 1 commit into
mainfrom
refactor/config-isolation-hot-reload

Conversation

@YoungSx

@YoungSx YoungSx commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Follows the official Pi Agent API recommendations to address configuration isolation, dynamic hot reloading, and credential visibility in Squid's settings panel.

1. 配置隔离 (Configuration Isolation)

  • Added resolveAgentDirPath() in src/config-paths.ts, isolating agent config files to <squid-config-dir>/agent (rather than colliding with global ~/.pi/agent).
  • Set process.env.PI_CODING_AGENT_DIR = agentDir during daemon preparation in src/squid-app.ts.
  • Explicitly passed agentDir parameter down through src/watch-desktop.ts, src/watch-session.ts, src/resident-agent.ts, and src/pi-session-factory.ts.

2. 支持热更新 (Hot Reloading)

  • Marked provider, model, and apiKey rows with applies: "now" in src/config-service.ts.
  • Added getProvider() and setProvider() in ConfigService to handle dynamic model provider switching.
  • Implemented restartAgent() in src/watch-session.ts with restarting state preservation to hot-reload resident sessions without restarting the entire daemon.

3. 配置明文显示 (Plaintext Config Display)

  • Updated ui/settings.slint input field to input-type: InputType.text;.
  • Configured apiKey row in ConfigService with kind: "text".
  • Exported and used readStoredCredentialKey() to send raw API keys to the panel.

Verification

  • Automated Tests: 812 passed, 0 failed across 64 test files (bun test).
  • Virtual Desktop Smoke Test: Native X11 Slint panel smoke test (bun run ui:smoke) successfully validated window creation, accessibility status headers, and interactive confirmation flows.

…nd plaintext key display

- Config Isolation: isolate Pi agent configuration directory under <squid-config-dir>/agent via resolveAgentDirPath(), set PI_CODING_AGENT_DIR in daemon launch, and explicitly pass agentDir down to Pi session factory and resident agent instances.
- Hot Reloading: mark provider, model, and apiKey settings as applies: 'now', allow dynamic provider get/set in ConfigService, and introduce restartAgent() in watch-session to hot reload live agent instances upon configuration updates without requiring a daemon restart.
- Plaintext Config Display: render apiKey in plaintext in settings.slint and config-service for user visibility and immediate editability.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-16T17:43:58.158587Z d91466e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@YoungSx
YoungSx merged commit 80d4bf7 into main Oct 16, 2026
3 checks passed
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