Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (opencode): refresh sessions on password change and silence duplicate revoke error

[._.]/ Adam Eivy495ea7f7300f
diff --git a/client/src/components/settings/SecurityTab.jsx b/client/src/components/settings/SecurityTab.jsx
index eb5ac2a153..3e26f474ab 100644
--- a/client/src/components/settings/SecurityTab.jsx
+++ b/client/src/components/settings/SecurityTab.jsx
@@ -54,10 +54,7 @@ export function SecurityTab() {
loadAuthStatus();
}, [loadAuthStatus]);
- // Sessions only exist while auth is on (agentApiAuth only mints a token
- // when isAuthEnabled(), and disabling clears every session) — skip the
- // fetch otherwise, and drop any list left over from a prior enabled state.
- useEffect(() => {
+ const loadSessions = useCallback(() => {
if (!enabled) {
setAgentSessions([]);
return;
@@ -76,6 +73,13 @@ export function SecurityTab() {
});
}, [enabled]);
+ // Sessions only exist while auth is on (agentApiAuth only mints a token
+ // when isAuthEnabled(), and disabling clears every session) — skip the
+ // fetch otherwise, and drop any list left over from a prior enabled state.
+ useEffect(() => {
+ loadSessions();
+ }, [loadSessions]);
+
const handleRevokeSession = async (id) => {
setRevokingId(id);
const result = await revokeAuthSession(id).catch((err) => err);
@@ -117,6 +121,7 @@ export function SecurityTab() {
setCurrentPassword('');
setNewPassword('');
setConfirmPassword('');
+ loadSessions();
toast.success(enabled ? 'Password updated' : 'Login password enabled');
};
diff --git a/client/src/components/settings/SecurityTab.test.jsx b/client/src/components/settings/SecurityTab.test.jsx
index a9a681c7b0..b792256c51 100644
--- a/client/src/components/settings/SecurityTab.test.jsx
+++ b/client/src/components/settings/SecurityTab.test.jsx
@@ -137,6 +137,31 @@ describe('SecurityTab', () => {
expect(screen.getByText('Login password enabled')).toBeInTheDocument();
});
+ it('refreshes agent sessions when password is changed', async () => {
+ api.getAuthStatus.mockResolvedValue({ enabled: true });
+ api.listAuthSessions
+ .mockResolvedValueOnce({
+ sessions: [{ id: 'agent-1', label: 'agent', expiresAt: Date.parse('2026-10-01T00:00:00Z') }],
+ })
+ .mockResolvedValueOnce({
+ sessions: [],
+ });
+ api.setAuthPassword.mockResolvedValue({ enabled: true });
+
+ render(<SecurityTab />);
+
+ expect(await screen.findByText('1 agent session')).toBeInTheDocument();
+
+ fireEvent.change(screen.getByLabelText('Current password'), { target: { value: 'old-password' } });
+ fireEvent.change(screen.getByLabelText('New password'), { target: { value: 'new-password-123' } });
+ fireEvent.change(screen.getByLabelText('Confirm new password'), { target: { value: 'new-password-123' } });
+ fireEvent.click(screen.getByRole('button', { name: 'Update password' }));
+
+ await waitFor(() => expect(api.setAuthPassword).toHaveBeenCalled());
+ await waitFor(() => expect(screen.queryByText('1 agent session')).not.toBeInTheDocument());
+ expect(api.listAuthSessions).toHaveBeenCalledTimes(2);
+ });
+
it('hides the sessions panel when auth is disabled', async () => {
api.getAuthStatus.mockResolvedValue({ enabled: false });
diff --git a/client/src/services/apiAuth.js b/client/src/services/apiAuth.js
index 31178113ae..6a0b00bd9b 100644
--- a/client/src/services/apiAuth.js
+++ b/client/src/services/apiAuth.js
@@ -27,6 +27,8 @@ export const listAuthSessions = (options) => request('/auth/sessions', options);
// Revokes one session by its opaque id — e.g. the agent's loopback
// credential — without signing the caller's own browser session out.
-export const revokeAuthSession = (id) => request(`/auth/sessions/${encodeURIComponent(id)}`, {
+export const revokeAuthSession = (id, options) => request(`/auth/sessions/${encodeURIComponent(id)}`, {
method: 'DELETE',
+ silent: true,
+ ...options,
});