Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 6 additions & 9 deletions libs/code/deepagents_code/tui/widgets/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,18 +881,15 @@ def compose(self) -> ComposeResult:
if self._env_var:
key_meta = Static(
Content.assemble(
"Alternatively, environment variables can be used in place "
"of the key stored above. Set ",
"Environment variables: ",
(f"DEEPAGENTS_CODE_{self._env_var}", TStyle(bold=True)),
" for a dcode-only key; it has the highest priority. Set ",
" (dcode only, highest priority) or ",
(self._env_var, TStyle(bold=True)),
" to share a key with other provider SDK tools; it is used "
"only when no scoped or stored key exists. After setting one "
"in a .env file, press ",
" (shared, lowest priority). Put either in the project .env "
"or ~/.deepagents/.env; press ",
("Ctrl+R", TStyle(bold=True)),
" to reload without restarting. A variable exported in a "
"separate shell after launch is invisible to this process; "
"it needs a full relaunch. ",
" in this dialog to reload. New shell exports require "
"restarting the app. ",
(
"Configuration docs",
self._link_style(CONFIGURATION_DOCS_URL),
Expand Down
27 changes: 9 additions & 18 deletions libs/code/tests/unit_tests/tui/widgets/test_auth_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ async def test_help_line_advertises_reload(self) -> None:
content = str(help_line.content)
assert "Ctrl+R reload" in content

async def test_advanced_copy_flags_reload_and_relaunch_caveat(self) -> None:
async def test_advanced_copy_flags_reload_and_restart_caveat(self) -> None:
"""Advanced env-var copy points at Ctrl+R and the separate-shell caveat."""
app = _AuthHostApp()
async with app.run_test() as pilot:
Expand All @@ -1515,7 +1515,7 @@ async def test_advanced_copy_flags_reload_and_relaunch_caveat(self) -> None:
app.screen.query_one("#auth-prompt-key-meta", Static).content
)
assert "Ctrl+R" in key_meta
assert "relaunch" in key_meta
assert "New shell exports require restarting the app" in key_meta

async def test_ctrl_d_opens_confirm_then_deletes(self) -> None:
"""Ctrl+D opens the confirmation modal; Enter completes the delete."""
Expand Down Expand Up @@ -1799,30 +1799,21 @@ async def test_init_does_not_crash_on_corrupt_store(
assert glyphs.warning not in title_text
assert glyphs.checkmark not in title_text

async def test_helper_text_describes_precedence(self) -> None:
"""Helper text names both env vars and their order vs the stored key.

A stored key sits between the plain var (which it beats) and the
`DEEPAGENTS_CODE_`-prefixed var (which beats it). The meta line must
convey that ordering, not imply the three are interchangeable.
"""
async def test_helper_text_describes_precedence_and_reload_location(self) -> None:
"""Helper text names env precedence, dotenv paths, and the reload scope."""
app = _AuthHostApp()
async with app.run_test() as pilot:
app.show_prompt("openai", "OPENAI_API_KEY")
await pilot.pause()
meta = app.screen.query_one("#auth-prompt-key-meta", Static)
text = str(meta.content)
assert "dcode stores" not in text
assert (
"Alternatively, environment variables can be used in place "
"of the key stored above." in text
)
assert "DEEPAGENTS_CODE_OPENAI_API_KEY" in text
assert "dcode-only key" in text
assert "highest priority" in text
assert "dcode only, highest priority" in text
assert "OPENAI_API_KEY" in text
assert "share a key with other provider SDK tools" in text
assert "used only when no scoped or stored key exists" in text
assert "shared, lowest priority" in text
assert "project .env or ~/.deepagents/.env" in text
assert "Ctrl+R in this dialog to reload" in text
assert "New shell exports require restarting the app" in text
assert "Configuration docs" in text

async def test_base_url_hint_names_endpoint_var(
Expand Down
Loading