Skip to content

feat(config): move runtime media defaults under ~/.infer/tmp and rename auth.json to auth.yaml - #1239

Merged
edenreich merged 6 commits into
mainfrom
fix/issue-1238
Sep 18, 2026
Merged

edenreich merged 6 commits into
mainfrom
fix/issue-1238

Conversation

@inference-gateway-maintainer

@inference-gateway-maintainer inference-gateway-maintainer Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #1238

Summary

Consolidates the ~/.infer/ layout along both axes the issue names. Runtime media dirs (generated speech, retained recordings, Telegram media) now default under ~/.infer/tmp/ with the other disposable output instead of beside configuration, and the userspace provider-key file becomes auth.yaml (YAML like every other hand-edited file there) with a read-only fallback so existing credentials are not orphaned. /reset covers the moved dirs through the existing UserspaceRuntimeDirNames loop, so its per-dir appends are gone.

Changes

  • text_to_speech.output_dir, speech_to_text.recordings_dir and channels.telegram.media.dir default to ~/.infer/tmp/{tts,voice,media}; explicit overrides keep working unchanged
  • Sandbox decision recorded in code comments and docs: ~/.infer/tmp stays in UserspaceRuntimeDirNames, so the agent's file tools can read and write tmp/{tts,voice,media} - that is the point of retaining recordings and media (the agent consumes them as assets) and of generated TTS output (the agent plays and can reference it)
  • ResetShortcut.targets() no longer appends the three resolved dirs; /reset wipes them via the tmp parent, and dirs explicitly overridden outside ~/.infer are deliberately left alone (documented in the shortcut's doc comment)
  • auth.json renamed to auth.yaml; LoadAuthKeys falls back to the legacy JSON file (JSON is a subset of YAML, so one parse covers both formats); auth.yaml joins the default protected_paths alongside auth.json
  • TestResetShortcut_WipesStateKeepsConfig still asserts generated speech, recordings and media are emptied, now as ~/.infer/tmp/{tts,voice,media}
  • File-format rule recorded in docs/directory-structure.md: hand-edited files are YAML (auth.yaml), machine-written state stays JSON (skills/catalog.json, schedules/github-artifacts-state.json, session_groups.json); no conversion churn for files nobody opens
  • Existing installs handled as a documented one-time move in docs/directory-structure.md (the old dirs hold only disposable retained media); no migration code

Docs

  • docs/directory-structure.md is the main update: the userspace tree now shows auth.yaml, tmp/{tts,voice,media}, telemetry/ and run/; a File Formats section records the YAML-vs-JSON rule; an Existing Installs section documents the one-time move
  • Cross-page path references updated: speech-to-text.md, text-to-speech.md, channels.md, configuration-reference.md, README.md, examples/telegram-channel/README.md
  • Follow-up cross-repo docs ticket: [DOCS] Document the new ~/.infer layout - tmp media dirs and auth.yaml docs#689
  • Cross-repo code ripple: the desktop repo does own ~/.infer/auth.json - backend/src/config.rs reads it (read_auth/get_auth), writes it at 0600 (set_auth) and injects it as env vars (auth_env). Once a user moves keys to auth.yaml as these docs now instruct, the desktop settings UI and the CLI read different stores and set_auth silently overwrites only the JSON one (desktop-spawned runs keep working, because injected env outranks the auth file). Tracked as [TASK] Refactor the provider key store to ~/.infer/auth.yaml desktop#282. Nothing else ripples: desktop's tts_samples.rs uses ~/.infer/models/tts/samples and env.rs uses ~/.infer/tmp/uploads, both untouched by the media dir move.

…me auth.json to auth.yaml

text_to_speech.output_dir, speech_to_text.recordings_dir and channels.telegram.media.dir now default to ~/.infer/tmp/{tts,voice,media}. The tmp dir is already in UserspaceRuntimeDirNames, so the agent sandbox reaches the subdirs and /reset wipes them via the existing loop - the per-dir appends in ResetShortcut.targets() are gone, and dirs explicitly overridden outside ~/.infer are deliberately left alone.

auth.json becomes auth.yaml with a read-only fallback to the legacy JSON file (JSON is a subset of YAML, one parse covers both) so existing credentials are not orphaned. auth.yaml joins the default protected_paths.
edenreich and others added 2 commits September 18, 2026 15:48
… migration

docs/directory-structure.md gains tmp/{tts,voice,media}, telemetry/ and run/ in the userspace tree and Created at Runtime list, a File Formats rule (hand-edited files are YAML, machine-written state stays JSON) and an Existing Installs note describing the one-time move of the old ~/.infer/{tts,voice,media} directories. speech-to-text, text-to-speech, channels, configuration-reference, README and the telegram example now point at the new default paths and the auth.yaml rename.
…l by name

writeLegacyAuthFile was writeAuthFile with one word changed; both now wrap a
shared writeAuthFileNamed that reuses an already-set temp HOME, so a test can
seed auth.yaml and auth.json together. TestLoadAuthKeys_LegacyUnreadableFile
re-tested the same err != nil branch as TestLoadAuthKeys_UnreadableFile and is
gone.

The new sandbox case pointed at .infer/auth.yaml, which the .infer/ rule in
ProtectedPaths already blocks, so it never exercised the auth.yaml entry it was
added for. Moving it outside the config dir makes it hit the bare-name branch.
The desktop's sidebar state moves to ~/.infer/projects.yaml alongside
desktop.yaml (inference-gateway/desktop#283), so the file-format rule for
~/.infer/ is now: anything a human may open is YAML, only opaque caches and
cursors stay JSON.

The CLI never parsed projects.json - it only carved the name out of the agent
sandbox and preserved it across /reset - so this swaps the carve-out to the
YAML name. The state is regenerable, so the app rebuilds it rather than
carrying two formats.
auth.yaml is the only provider-key file the CLI looks at. The legacy read,
its constant, the two fallback test cases and the auth.json protected_paths
entry are gone, along with the migration prose in the README and docs.

Also sweeps the stale auth.json references left behind by #1169 in
internal/gateway and internal/agent/application, and switches the gateway
env fixtures from JSON bodies to the YAML users actually write.
@edenreich
edenreich merged commit ad9247c into main Sep 18, 2026
1 check passed
@edenreich
edenreich deleted the fix/issue-1238 branch September 18, 2026 14:52
edenreich added a commit to inference-gateway/desktop that referenced this pull request Sep 18, 2026
…284)

inference-gateway/cli#1239 renamed the userspace provider-key file to
auth.yaml and removed the auth.json read path, so keys saved from Settings
-> API Keys landed in a file nothing reads. Desktop-spawned runs kept
working only because auth_env() injects the pairs as environment variables,
which outrank the auth file - running `infer` from a terminal got no keys.

Straight rename matching the CLI, no fallback read. serde_norway already
backs the config.yaml reader, so this is a serializer swap, not a new dep.
The in-memory type becomes BTreeMap<String, String> - what the file and the
frontend Record<string, string> both already are, with deterministic key
order on write. auth_path/read_auth/write_auth gain a home-rooted seam so
the tests run against a temp dir, mirroring read_config_in.

Resolves #282
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.203.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Sep 18, 2026
edenreich added a commit to inference-gateway/desktop that referenced this pull request Sep 18, 2026
* refactor(projects): move projects.json and desktop.json to YAML

inference-gateway/cli#1239 records the ~/.infer file-format rule: files a
human may open are YAML, only opaque caches stay JSON. projects.yaml is on
the YAML side twice over - people open it to work out why a chat landed in
the wrong project, and the CLI carves it out of the agent sandbox
(config.go isWithinConfigSubdir) so the agent can edit it on the user's
behalf.

Straight rename, no fallback read and no migration: both files hold
regenerable sidebar and app state, so carrying two formats would cost more
than re-creating a layout once. serde_norway already backs the config.yaml
reader, so this is a serializer swap rather than a new dep.

The six hand-rolled read-parse-default / write-serialize copies of
projects.json across projects.rs, agent.rs and export.rs collapse onto one
read_projects_in / write_projects_in pair in projects.rs. The read/write
Tauri commands keep their JSON-text contract with the frontend and convert
at the boundary, so the webview needs no YAML parser and store.tsx is
unchanged.

One-time loss: a user still holding projects.json sees a clean sidebar and
re-creates grouping and path overrides once.

Resolves #283

* Apply suggestion from @edenreich
@edenreich edenreich moved this from Todo to Done in 2026 Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

[TASK] Refactor consolidate ~/.infer/ layout - runtime media under tmp/, YAML state files

1 participant