feat: add enable_state_persistence variable and update README for state management
This commit is contained in:
parent
b5e79685e6
commit
d6b490ecb2
@ -13,7 +13,7 @@ Run [GitHub Copilot CLI](https://docs.github.com/copilot/concepts/agents/about-c
|
|||||||
```tf
|
```tf
|
||||||
module "copilot" {
|
module "copilot" {
|
||||||
source = "registry.coder.com/coder-labs/copilot/coder"
|
source = "registry.coder.com/coder-labs/copilot/coder"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
workdir = "/home/coder/projects"
|
workdir = "/home/coder/projects"
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ data "coder_parameter" "ai_prompt" {
|
|||||||
|
|
||||||
module "copilot" {
|
module "copilot" {
|
||||||
source = "registry.coder.com/coder-labs/copilot/coder"
|
source = "registry.coder.com/coder-labs/copilot/coder"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
workdir = "/home/coder/projects"
|
workdir = "/home/coder/projects"
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ Customize tool permissions, MCP servers, and Copilot settings:
|
|||||||
```tf
|
```tf
|
||||||
module "copilot" {
|
module "copilot" {
|
||||||
source = "registry.coder.com/coder-labs/copilot/coder"
|
source = "registry.coder.com/coder-labs/copilot/coder"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
workdir = "/home/coder/projects"
|
workdir = "/home/coder/projects"
|
||||||
|
|
||||||
@ -215,6 +215,19 @@ By default, the module resumes the latest Copilot session when the workspace res
|
|||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> Session resumption requires persistent storage for the home directory or workspace volume. Without persistent storage, sessions will not resume across workspace restarts.
|
> Session resumption requires persistent storage for the home directory or workspace volume. Without persistent storage, sessions will not resume across workspace restarts.
|
||||||
|
|
||||||
|
## State Persistence
|
||||||
|
|
||||||
|
AgentAPI can save and restore its conversation state to disk across workspace restarts. This complements `resume_session` (which resumes the Copilot CLI session) by also preserving the AgentAPI-level context. Enabled by default, requires agentapi >= v0.12.0 (older versions skip it with a warning).
|
||||||
|
|
||||||
|
To disable:
|
||||||
|
|
||||||
|
```tf
|
||||||
|
module "copilot" {
|
||||||
|
# ... other config
|
||||||
|
enable_state_persistence = false
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
If you encounter any issues, check the log files in the `~/.copilot-module` directory within your workspace for detailed information.
|
If you encounter any issues, check the log files in the `~/.copilot-module` directory within your workspace for detailed information.
|
||||||
|
|||||||
@ -347,3 +347,32 @@ run "aibridge_proxy_with_copilot_config" {
|
|||||||
error_message = "copilot_model environment variable should be set alongside proxy"
|
error_message = "copilot_model environment variable should be set alongside proxy"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run "enable_state_persistence_default" {
|
||||||
|
command = plan
|
||||||
|
|
||||||
|
variables {
|
||||||
|
agent_id = "test-agent"
|
||||||
|
workdir = "/home/coder"
|
||||||
|
}
|
||||||
|
|
||||||
|
assert {
|
||||||
|
condition = var.enable_state_persistence == true
|
||||||
|
error_message = "enable_state_persistence should default to true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run "disable_state_persistence" {
|
||||||
|
command = plan
|
||||||
|
|
||||||
|
variables {
|
||||||
|
agent_id = "test-agent"
|
||||||
|
workdir = "/home/coder"
|
||||||
|
enable_state_persistence = false
|
||||||
|
}
|
||||||
|
|
||||||
|
assert {
|
||||||
|
condition = var.enable_state_persistence == false
|
||||||
|
error_message = "enable_state_persistence should be false when explicitly disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -119,6 +119,12 @@ variable "subdomain" {
|
|||||||
default = false
|
default = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "enable_state_persistence" {
|
||||||
|
type = bool
|
||||||
|
description = "Enable AgentAPI conversation state persistence across restarts."
|
||||||
|
default = true
|
||||||
|
}
|
||||||
|
|
||||||
variable "order" {
|
variable "order" {
|
||||||
type = number
|
type = number
|
||||||
description = "The order determines the position of app in the UI presentation."
|
description = "The order determines the position of app in the UI presentation."
|
||||||
@ -291,11 +297,12 @@ module "agentapi" {
|
|||||||
cli_app_icon = var.cli_app ? var.icon : null
|
cli_app_icon = var.cli_app ? var.icon : null
|
||||||
cli_app_display_name = var.cli_app ? var.cli_app_display_name : null
|
cli_app_display_name = var.cli_app ? var.cli_app_display_name : null
|
||||||
agentapi_subdomain = var.subdomain
|
agentapi_subdomain = var.subdomain
|
||||||
module_dir_name = local.module_dir_name
|
module_dir_name = local.module_dir_name
|
||||||
install_agentapi = var.install_agentapi
|
install_agentapi = var.install_agentapi
|
||||||
agentapi_version = var.agentapi_version
|
agentapi_version = var.agentapi_version
|
||||||
pre_install_script = var.pre_install_script
|
enable_state_persistence = var.enable_state_persistence
|
||||||
post_install_script = var.post_install_script
|
pre_install_script = var.pre_install_script
|
||||||
|
post_install_script = var.post_install_script
|
||||||
|
|
||||||
start_script = <<-EOT
|
start_script = <<-EOT
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user