feat: instance-level SSH key selection for container mounting

- Revert mistaken ssh_key_id from ConfigProfile (model, API, resolver, frontend)
- Add ssh_key_ids JSON column to tool_instances via migration
- Update create_instance to accept and store ssh_key_ids
- Update start_instance to mount selected SSH keys to {home_dir}/.ssh
- Update list_instances to return ssh_key_ids
- Frontend CreateSessionForm: multi-select SSH key checkboxes
- Frontend instance-list: SSH key selector for start/restart actions
- Maintain separate SSH key dirs per key to avoid conflicts

Quality gates: pytest (231 passed, 6 pre-existing), tsc --noEmit clean
This commit is contained in:
Alex Blank
2026-05-29 13:30:53 +02:00
parent cbd3436ff7
commit e9364fa70f
14 changed files with 2049 additions and 1524 deletions
@@ -1,26 +1,27 @@
name: ssh-key-mounting
status: implementing
status: implemented
priority: high
created_at: 2026-05-28
updated_at: 2026-05-28
updated_at: 2026-05-29
labels:
- feature
- ssh
- config-profiles
- instances
stories:
- title: Select SSH key in config profile
- title: Select SSH keys when creating/starting instances
description: |
Add ssh_key_id to ConfigProfile so users can select an SSH key
to mount into container home directory (~/.ssh) when starting
a tool instance with that profile.
Add ssh_key_ids to ToolInstance so users can select multiple SSH keys
from a list when creating or starting a tool instance. Selected keys
are mounted into the container user's home directory (~/.ssh).
acceptance_criteria:
- ConfigProfile model has nullable ssh_key_id column
- Config profile API accepts/returns ssh_key_id
- ResolvedProfile includes ssh_key_id
- start_instance mounts SSH key to {home_dir}/.ssh after applying profile
- Frontend config profile form has SSH key selector dropdown
- Git mount URL validation defaults to profile's SSH key
- ToolInstance model has nullable ssh_key_ids JSON column
- create_instance endpoint accepts ssh_key_ids list
- start_instance endpoint accepts ssh_key_ids override
- start_instance mounts all selected SSH keys to {home_dir}/.ssh
- Frontend CreateSessionForm shows multi-select SSH key checkboxes
- Frontend instance-list shows SSH key multi-select for start/restart
- SSH keys are validated (existence, user ownership) before mounting
tests:
- unit: test_config_profile_resolver.py (resolver includes ssh_key_id)
- unit: test_tool_instances_legacy.py (ssh key mount integration)
- unit: test_tool_instances_legacy.py (existing baseline)
- integration: manual verification of mount behavior
estimated_effort: small