Skip to content

fix: preserve workspace .env when importing generated credential seed - #3711

Merged
vybe merged 3 commits into
Abilityai:devfrom
alex-furman:fix/3710-preserve-workspace-env
Oct 14, 2026
Merged

vybe merged 3 commits into
Abilityai:devfrom
alex-furman:fix/3710-preserve-workspace-env

Conversation

@alex-furman

@alex-furman alex-furman commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3710.

Preserve an existing workspace .env when importing the generated credential seed during agent startup. Previously, restarting could replace injected or intentionally cleared values with the older seed. A missing workspace file is still seeded; .mcp.json, other credential files, and the separate encrypted-credential import are unchanged.

The fix changes only the seed copy to no-clobber. Regression tests execute the actual startup import block with isolated temporary paths and synthetic values, covering initial seeding, rotated and empty workspace files, permissions, and symlink targets.

Validation: stock reproduction 3 failed / 2 passed; patched credential/startup suites 121 passed, independently repeated. Shell syntax and diff checks pass. This is shell-boundary coverage; a full container restart/recreate and the entire test suite were not run.

Journey Impact: extends: J06

Mutation: test_restart_preserves_injected_or_deliberately_cleared_env and the existing-target case of test_restart_does_not_follow_existing_env_symlink fail on the unmodified startup block (3 failures).

)

merge-train: mechanical, per the merge-train note on the PR. BSD cp -n
stats through a dangling symlink and creates the target; GNU coreutils in
the production base image hits EEXIST and skips. The production behaviour
is the one under test; the non-portable parametrisation is skipped on
darwin so the file is green on core-team laptops as well as in CI.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@vybe

vybe commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

merge-train note (mechanical fix pushed to your branch, commit 9142959):

  • tests/unit/test_generated_env_restart.py: the exists=False case of test_restart_does_not_follow_existing_env_symlink is now skipped on macOS. BSD cp -n stats through a dangling symlink and creates the target, while GNU coreutils in the production base image hits EEXIST and skips, so the case was red on every core-team laptop and green in CI. Production behaviour (GNU) is what the test pins; nothing else changed.

Validated at 739f8ba: the credential-rotation question is cleared (the seed is written once at creation with empty placeholders and never regenerated; injected values reach the workspace .env through the inject endpoint), so the unconditional copy was rolling injected credentials back on every restart. Also labelled #3710 priority-p2 / type-bug / theme-reliability. Thanks for the fix.

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

merge-train: batch validated on train/20261014-1750 (train PR #3729 green)

@vybe
vybe merged commit b400332 into Abilityai:dev Oct 14, 2026
23 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.

4 participants