Skip to content

fix(kernel): sync all agent.toml fields to DB on restart#1118

Open
octo-patch wants to merge 1 commit intoRightNow-AI:mainfrom
octo-patch:fix/issue-1087-agent-config-toml-sync
Open

fix(kernel): sync all agent.toml fields to DB on restart#1118
octo-patch wants to merge 1 commit intoRightNow-AI:mainfrom
octo-patch:fix/issue-1087-agent-config-toml-sync

Conversation

@octo-patch
Copy link
Copy Markdown

Fixes #1087

Problem

The TOML-vs-DB change detection at boot time only compared a subset of
AgentManifest fields (name, description, model.*, capabilities.tools,
tool_allowlist, tool_blocklist, skills, mcp_servers). Key fields like
workspace, schedule, resources, autonomous, and exec_policy were
silently skipped, so editing them in agent.toml and restarting OpenFang had
no effect — the old values from the SQL database were used instead.

Solution

  • Derive PartialEq on ScheduleMode, AutonomousConfig, ResourceQuota,
    and ExecPolicy so they can be compared directly.
  • Extend the changed predicate in the boot-time TOML sync loop to cover all
    the previously missing fields.
  • The workspace comparison is guarded: if the TOML omits the field (None),
    the kernel-assigned default path already in the DB is preserved rather than
    being overwritten. If the TOML explicitly sets a path, that path is compared
    against the DB and an update is triggered when they differ.

Testing

Manually verified the fix by:

  1. Spawning an agent without an explicit workspace in its agent.toml.
  2. Adding workspace = "/tmp/custom-workspace" to agent.toml.
  3. Restarting OpenFang — confirmed the new workspace was applied to the DB and
    used by the agent.
  4. Removing the workspace line — confirmed restart preserves the previously
    set path rather than reverting to the auto-generated default.

…Now-AI#1087)

The TOML-vs-DB change detection at boot only checked a subset of fields,
causing edits to workspace, schedule, resources, autonomous, and exec_policy
to be silently ignored after a restart.

Add the missing fields to the changed-detection predicate so the kernel
properly reflects all agent.toml edits in the SQL database. The workspace
comparison is intentionally guarded — if the TOML omits workspace (None),
the kernel-assigned default path already stored in the DB is kept rather
than being overwritten with None.

Derive PartialEq on ScheduleMode, AutonomousConfig, ResourceQuota, and
ExecPolicy to enable the comparisons without manual field-by-field expansion.

Co-Authored-By: Octopus <liyuan851277048@icloud.com>
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.

Agent configuration not updating in SQL database

1 participant