ACON: Optimizing Context Compression for Long-horizon LLM Agents