Skip to content

fix(voice): extract raw SQL to DB layer (Invariant 1) (#351) - #353

Merged
vybe merged 1 commit into
mainfrom
feature/351-architecture-layer-fix
Apr 15, 2026
Merged

vybe merged 1 commit into
mainfrom
feature/351-architecture-layer-fix

Conversation

@vybe

@vybe vybe commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Move voice_system_prompt DB operations from routers/voice.py to db/agents.py
  • Add get_voice_system_prompt() and set_voice_system_prompt() methods to AgentOperations
  • Remove raw SQL helper _get_voice_system_prompt_raw()
  • All 4 call sites now use proper DB layer

Scope

Partial fix for #351 — only voice.py violations addressed.

Out of scope (process engine, per user request):

  • routers/triggers.py — process_schedules SELECT
  • routers/processes.py — process_schedules CREATE/INSERT/DELETE
  • Process engine schema violations (Invariant 3)

Test Plan

  • Voice prompt GET/PUT endpoints work (/api/agents/{name}/voice/prompt)
  • Voice status shows voice_prompt_set correctly
  • Voice chat initiation reads prompt from DB

Closes #351 (partial — voice.py only)

Generated with Claude Code

Move voice_system_prompt operations from routers/voice.py to db/agents.py:
- Add get_voice_system_prompt() and set_voice_system_prompt() to AgentOperations
- Remove _get_voice_system_prompt_raw() helper with raw cursor.execute()
- Update all 4 call sites to use db.agents.*

Partial fix for #351 — only voice.py violations addressed per scope.
Process engine violations (triggers.py, processes.py) out of scope.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@vybe
vybe merged commit eefa640 into main Apr 15, 2026
vybe added a commit that referenced this pull request Oct 19, 2026
…, Storage, People, one restart banner (ent#887, #888, #890, #891, #353) (#3798)

* feat(ui): one Settings home for the agent — rail, General, Guardrails, Storage, People, one restart banner

The agent page splits into a working strip and ONE Settings tab, pinned at
the end of the strip, with a rail of panes each answering one question
(decision on #966). The pane is in the URL
(?tab=settings&section=…); old ?tab=info|guardrails|credentials|folders|access
links land on their pane.

- General (Abilityai/trinity-enterprise#887): identity (label, id rename,
  avatar, description, tags), runtime/model/funding, execution timeout
  (Abilityai/trinity-enterprise#353 — named range error, #929 schedule
  conflict with an Open Schedules action), parallel capacity, read-only,
  memory/CPU, template details, Danger zone (reset to main only with a bound
  repo; delete). The header keeps identity, state, the autonomy chip and the
  doors; live usage and spend move to Overview; Pull/Push move to the Git tab.
- One restart banner: rows report to stores/agentRestart.js; memory/CPU is
  saved and applied on the next restart instead of restarting at once.
- Guardrails (Abilityai/trinity-enterprise#890): rules, self-change
  permissions (ent#756), gated-skill count, autonomy read-only until
  PR #2984 merges, cross-model validation, reliability.
- Storage (Abilityai/trinity-enterprise#888): repository, GitHub token,
  git sync, credentials, shared folders, file sharing. Credentials and
  Folders tabs removed; Sharing loses Distribution.
- People (Abilityai/trinity-enterprise#891): the Access tab, unchanged.
- Channels/Integrations hold the Voice / MCP cards from the old flat list and
  point at the tabs that still hold the rest.

Red before green: agentSettingsHome.spec.js (7 strip/alias cases) and the
file-sharing restart report fail against dev's agentTabs.js and
FileSharingPanel.vue.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(agent-settings): restore the controls the Settings home dropped, settle the restart banner on the status edge (ent#887, ent#888)

A completeness audit against dev found five controls with no new home and
three defects in the one restart banner:

- Memory/CPU: the "Inherit default" choice is back, so a per-agent override
  can be cleared again; the editor seeds from the override, not the
  effective value, and saves an empty choice as null.
- Capacity: a stored value above the fleet ceiling says so, and names the
  value that applies.
- Git tab: the "Refresh status" button the header had; the Settings › Storage
  link is shown only to owners, who have that tab.
- General › Avatar: "Next emotion" for a prompt-generated avatar.
- Overview: a stopped agent's "Created" line.

- The banner's list is cleared on the agent's stopped → running edge, not by
  the button: a start that fails keeps every waiting change listed (the
  lifecycle composable reports and returns normally, so the old code read a
  failed start as success and lost the guardrails / GitHub-token entries),
  and a manual stop/start from the header settles the list too.
- FileSharingPanel resets on an in-place agent switch, so agent A's
  "restart required" is never announced for agent B.

Also: the two @Interactive e2e specs that deep-linked to ?tab=info now open
Settings › General → Technical details; user docs name Settings › Storage /
People instead of the retired Credentials / Access / Folders tabs.

Red first: agentSettingsRestart.mount.spec.js (failed start kept nothing,
manual start settled nothing), fileSharingPanelAudience.spec.js (switch
carried the wait over), agentSettingsHome.mount.spec.js (no inherit option,
no ceiling note) — 5 assertions red on the previous commit.

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

* docs(screenshots): drop deleted SettingsPanel.vue from settings-general sources

The agent Settings home (ent#887) deletes components/settings/SettingsPanel.vue.
That component was the agent page's old Settings tab, never part of the platform
Settings view the screenshot shows, and screenshot-guard fails on a missing source.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(1712): repoint the ReliabilityPanel wiring guard at the Guardrails pane

The agent Settings home (ent#887) deletes components/settings/SettingsPanel.vue
and mounts ReliabilityPanel in agent-settings/GuardrailsPane.vue. The guard now
reads the pane and asserts the rendered tag, not just the name. Negative control:
removing the <ReliabilityPanel> tag turns it red.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: trinity-ability <[email protected]>
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.

Architecture Validation: 2 critical violations found (Invariants 1 & 3)

1 participant