[Feature]: Entity-preserving context condensation (anchor retention for exact IDs, hashes, and redacted values)
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- ai-infra-agents, backend-api-design, testing
Direzione di ricerca
Read openhands-sdk/openhands/sdk/context/condenser/prompts/summarizing_system.j2, LLMSummarizingCondenser._build_summary_messages, and CondensationSummaryEvent.to_llm_message(); inspect Condensation and tests under tests/sdk/context/condenser/. Run the condenser unit tests first, then check event serialization and the TypeScript schema mirror. Done means the prompt preserves exact literals, the replacement message identifies the forgotten event span, and optional size metadata is covered by tests. An open linked pull request (#6998) is already addressing this issue.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is there an existing feature request for this?
- I have searched existing issues and feature requests, and this is not a duplicate.
Problem or Use Case
During long-horizon tasks with large file reads, LLM-based condensation summarizes evicted turns into prose. While high-level task intent survives, exact load-bearing literals observed only in evicted turns (such as certificate thumbprints, SHA digests, ISO timestamps, ticket IDs, or pre-redaction audit values that were intentionally removed from workspace files) are routinely paraphrased or dropped by the summarizer.
In our evaluation on TraceTrial-Bench (arXiv:2610.32285, mechanism node C2 — C2-cert-rotation-redaction-001 & C2-depbump-redaction-002), OpenHands triggered native condensation as expected (hr_native_compaction_after_pressure passed), but 0/6 exact suffix/timestamp values survived in the active summary (hr_active_summary_preserved_sensitive_details=False), directly causing downstream deliverable failures (harness_caused).
Desired Behavior
Enhance the SDK condenser (LLMSummarizingCondenser / Condensation) with entity-anchor preservation:
- Update the condensation prompt and/or pre-extraction pass to explicitly preserve exact identifiers, hashes/thumbprints, timestamps, numeric totals, file paths, and anomaly/task IDs encountered in forgotten events inside a structured
<preserved_facts>/ key-value block within the summary. - Expose condensation metadata on the
Condensationevent (e.g. range of condensed event IDs and character/token counts before vs. after) so the agent knows exact history boundaries were summarized rather than silently vanished.
Acceptance Criteria
-
LLMSummarizingCondenserpreserves exact load-bearing identifiers, digests, timestamps, and numeric figures from condensed events in a dedicated structured section of the summary - Model-visible condensation notice clearly indicates the condensed turn/event span
- Unit and benchmark regression tests verify exact literal survival across condensation boundaries
OpenHands AI triage
The following comments and acceptance criteria were added by the OpenHands AI agent.
Triage
Scope (verified against the repository): the summarization instructions live in openhands-sdk/openhands/sdk/context/condenser/prompts/summarizing_system.j2, rendered by LLMSummarizingCondenser._build_summary_messages; the model-visible replacement for forgotten events is CondensationSummaryEvent.to_llm_message() (currently a plain user message with no span indication); and the Condensation event already carries forgotten_event_ids and summary_offset. The work is therefore bounded to: (1) extending the rendered summarization prompt so it requires a dedicated structured section (e.g. <preserved_facts>) holding exact load-bearing literals from the summarized events, (2) making the model-visible summary state the condensed span, and (3) recording before/after size metrics on Condensation as optional fields.
Priority: medium. The issue records a reproduced failure of the real condensation workflow (a public TraceTrial-Bench run where native condensation preserved 0/6 measured literals and downstream deliverables failed), which meets the medium bar of a reproduced failure in the actual product/workflow; there are no user support reports or production incidents, so not high.
Non-goals: no deterministic pre-extraction/regex entity pass (prompt-level preservation first; revisit only if shown insufficient); no changes to NoOpCondenser, PipelineCondenser, or condenser sizing defaults (max_size/keep_first); no integration of TraceTrial-Bench into this repository; no changes to secret redaction (existing pydantic_secrets handling untouched). Note: literal survival through an LLM summarizer is stochastic, so the deterministic gates are the rendered-prompt instructions plus the repo's real-LLM condenser integration tests, not a hard "every literal survives" assertion.
Acceptance Criteria
- The rendered summarization prompt sent to the condenser LLM instructs preserving exact load-bearing literals from the summarized events (identifiers, hashes/thumbprints, timestamps, numeric totals, file paths, and ticket/anomaly IDs) in a dedicated structured section of the summary.
- After condensation, the user-role message the LLM sees in place of forgotten events states that a condensation occurred and identifies the span it replaces (e.g., the number or range of condensed events).
- The
Condensationevent records before/after size metrics for the condensed span (character counts before vs. after, plus token counts where a token count is available) as optional fields with defaults, alongside the existingforgotten_event_ids. - Old persisted events still load:
Condensationpayloads without the new fields and existingCondensationSummaryEventpayloads deserialize and apply to views unchanged, pertests/sdk/event/test_event_serialization.py. - Unit tests under
tests/sdk/context/condenser/using the existing mocked-LLM fixture verify the rendered prompt instructions, the new metadata, and the span notice in the model-visible message; existing condenser unit tests still pass. - The new optional
Condensationfields appear in the agent-server OpenAPI schema and the regeneratedclients/typescript/mirror. - The PR adds the
integration-testlabel so the real-LLM condenser integration tests (tests/integration/tests/c02_hard_context_reset.py,c05_size_condenser.py) run against the updated summarization prompt and pass.
- Lingua principale
- Python
- Stelle
- 1.4k
- Fork
- 797
- Merge medio
- 1g 17h
- PR unite (30g)
- 354
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenHands/software-agent-sdk
-
[Bug]: `list_directory` reports a complete listing as truncated when a directory has exactly 500 entriesForse già presa @balabommablock-cpu l’ha presa 29 giorni fa. Apertabug priority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
OpenHands/software-agent-sdk#6133 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Command hook that exits 1 is treated as blocking when its stdout is a JSON `deny` or `continue: false`Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug priority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OpenHands/software-agent-sdk#6116 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: TypeScript GET-with-body requests remain pending after a truncated responseForse già presa @BlueRaddish l’ha presa 34 giorni fa. Apertabug priority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
OpenHands/software-agent-sdk#6059 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Document whether `prompt_tokens` includes `cache_read_tokens` in accumulated token usageForse già presa @Jaxon1216 l’ha presa 36 giorni fa. Apertapriority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OpenHands/software-agent-sdk#5975 ·
I maintainer di solito rispondono entro 1 giorno
-
priority:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OpenHands/software-agent-sdk#5708 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OpenHands/software-agent-sdk
Issue simili
-
[Bug]: reme CLI crashes when the running server used a relative config pathForse già presa @nurlanmnn l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
agentscope-ai/ReMe#770 ·
I maintainer di solito rispondono entro 1 giorno
-
Pi: paused model calls are reported as "not signed in" when the model's provider comes from an extensionForse già presa @balcsida l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
microsoft/TokenEconomizer#288 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 67/100
sickn33/agentic-awesome-skills#2437 ·
I maintainer di solito rispondono entro 1 giorno
-
site-bug triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ethereum/consensus-specs#5846 ·
I maintainer di solito rispondono entro 1 giorno