Enable context compaction only for persistent agentd sessions

t-796·WorkTask·
·
·
Created4 days ago·Updated4 days ago·pipeline runs →

Dependencies

Description

Edit

Enable context compaction only for agentd persistent sessions.

Requirements:

  • Persistent sessions launched via agentd should run agent with compaction enabled.
  • Standard agent runs (direct CLI, ava, oneshot flows) must remain no-compaction by default.
  • Keep behavior explicit and testable.

Likely implementation:

  • Add an agent CLI flag (e.g. --enable-compaction) that toggles OpAgent.acCompaction in Omni/Agent.hs.
  • Wire persistent runtime wrapper in Omni/Agentd/Daemon.hs to pass that flag.
  • Update tests/docs accordingly.

Git Commits

9784bb40feat(agent): add persistent-only context compaction toggle
Coder Agent4 days ago3 files

Timeline (6)

🔄[human]Open → InProgress4 days ago
💬[human]4 days ago

Implemented in commit 9784bb40.

What changed:

  • Omni/Agent.hs
  • Added CLI switch --enable-compaction.
  • Added optEnableCompaction to AgentOptions (default false).
  • Wired compaction into OpAgent config only when that flag is set.
  • Compaction config is model-aware:
  • context limit = Models.getContextWindow modelName
  • summarization model = current run model (Op.Model modelName)
  • Dry-run output now prints compaction enabled/disabled.
  • Omni/Agentd/Daemon.hs
  • Persistent runtime wrapper now always passes --enable-compaction.
  • Added test assertion that persistent script contains --enable-compaction.
  • Omni/Agentd/SPEC.md
  • Documented that persistent wrappers enable compaction while direct agent runs remain default no-compaction.

Validation:

  • typecheck.sh Omni/Agent.hs
  • typecheck.sh Omni/Agentd/Daemon.hs
  • bild --test Omni/Agent.hs
  • bild --test Omni/Agentd/Daemon.hs
  • lint Omni/Agent.hs Omni/Agentd/Daemon.hs Omni/Agentd/SPEC.md

Behavior checks:

  • _/bin/agent --dry-run "hello" shows Compaction: disabled.
  • _/bin/agent --dry-run --enable-compaction "hello" shows Compaction: enabled.
  • Temporary persistent session smoke test confirmed generated agentd-agent-exec includes --enable-compaction and per-agent env file still omits AGENTD_AGENT_COMMAND.
🔄[human]InProgress → Review4 days ago
💬[human]4 days ago

Ran rollout on live host: ship.sh Omni/Agentd.hs succeeded; manifest now agentd rev 9784bb40 store /nix/store/frpy2v62rgrdaqb32na6ms54mc7n5p1j-agentd. Restarted persistent agents: sd-coder, cfg-coder, omni-coder, intent-coder, paracoder. Verified all status=running systemd=active. Verified generated persistent wrapper now includes --enable-compaction and no AGENTD_AGENT_COMMAND in runtime assets.