Skip to content

chore: read the app version from package.json only - #2217

Draft
Douglasymlai wants to merge 1 commit into
mainfrom
chore/single-version-source
Draft

Douglasymlai wants to merge 1 commit into
mainfrom
chore/single-version-source

Conversation

@Douglasymlai

Copy link
Copy Markdown
Contributor

Problem

Every release had to write the new version number in five places: package.json, the Brain's terminal toolkit, the bug-report issue template, a comment in build.yml, and the updater unit test. Missing one of them breaks things quietly. For example, if the Brain's copy is stale, it looks for the terminal environment under the wrong ~/.eigent/venvs/terminal_base-<version> folder. Agents then lose the preinstalled terminal packages and fall back to a slower copy of the Brain's own environment.

Cause

The Brain hardcoded APP_VERSION, and the test, template and comment each held a literal copy of the current release number.

Fix

  • When Electron starts the Brain, it now passes app.getVersion() (the package.json version) as EIGENT_APP_VERSION. Electron already uses this same value to name the terminal venv, so both sides always agree.
  • The Brain reads the version in a new app/utils/app_version.py, in this order: the EIGENT_APP_VERSION env var, then the repository's package.json (for a Brain started from a source checkout without Electron), then unknown. A value is only used if it looks like a plain version string, because it becomes part of a folder name.
  • The updater test now uses a fixed fixture version that does not follow releases.
  • The bug-report template placeholder and the build.yml comment no longer name a specific version.

After this change, a release only needs to edit package.json.

Testing

  • pytest tests/app/utils/test_app_version.py tests/app/agent/toolkit/test_terminal_toolkit.py tests/app/agent/toolkit/test_terminal_preflight_integration.py: 46 passed. The new tests check that the env var wins, the package.json fallback works, unsafe values are rejected, and in a source checkout the result matches the root package.json.
  • npx vitest run test/unit/electron/githubReleaseCdnProvider.test.ts test/unit/electron/main/brainAppVersionEnv.test.ts test/unit/electron/main/bundledGitPackaging.test.ts: 9 passed.
  • npm run type-check, eslint, prettier --check, ruff check/ruff format --check, git diff --check: clean.
  • Not run: a packaged-app smoke test. To check by hand, start the desktop app and confirm the Brain log has no "Terminal base venv not found" warning when an agent first uses the terminal. In a packaged build, also confirm that ~/.eigent/venvs/terminal_base-<package.json version> is the folder that gets cloned.

This branch has not been deployed

No deployments
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