Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions assistant/src/cli/commands/autonomy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { homedir } from "node:os";
import { dirname, join } from "node:path";

import type { Command } from "commander";

import { getWorkspaceDir } from "../../util/platform.js";
import { log } from "../logger.js";

// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -33,8 +33,7 @@ const DEFAULT_AUTONOMY_CONFIG: AutonomyConfig = {
// ---------------------------------------------------------------------------

function getConfigPath(): string {
const root = join(process.env.BASE_DATA_DIR?.trim() || homedir(), ".vellum");
return join(root, "workspace", "autonomy.json");
return join(getWorkspaceDir(), "autonomy.json");
Comment on lines 35 to +36
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve legacy autonomy path during workspace switch

Add a compatibility read (or one-time migration) from the previous BASE_DATA_DIR-derived location before switching fully to getWorkspaceDir(). As written, any existing autonomy.json created by earlier builds at $BASE_DATA_DIR/.vellum/workspace/autonomy.json will now be ignored when VELLUM_WORKSPACE_DIR points elsewhere, so assistant autonomy get/set starts from defaults and silently drops prior user settings after upgrade.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is already called out in the PR description's review checklist:

Migration edge case: If any containerized instance has already written autonomy.json to the old (incorrect) path, this fix will cause it to silently reset to defaults since it won't find the file at the new path. Assess whether any deployed instances could be affected and whether a migration or fallback read is needed.

@dvargas92495 — let me know if you'd like me to add a fallback read from the old path, or if this is fine as-is (since the old path was arguably a bug — it wouldn't have been the correct location in containerized mode anyway).

}

function isValidTier(value: unknown): value is AutonomyTier {
Expand Down Expand Up @@ -197,8 +196,7 @@ Resolution order (first match wins):
3. Channel default — per-channel tier set via --channel
4. Global default — the fallback tier set via --default

Config is stored in <data-dir>/.vellum/workspace/autonomy.json, where
<data-dir> is the BASE_DATA_DIR environment variable (defaults to $HOME).
Config is stored in <workspace>/autonomy.json (resolved via getWorkspaceDir()).

Examples:
$ assistant autonomy get
Expand Down
Loading