yf176 commited on
Commit ·
a03fcd1
1
Parent(s): d30caaf
fix: forbid nested evidence leakage in prompts
Browse files
src/polyhedra/agents/quant/io_registry.py
CHANGED
|
@@ -204,6 +204,9 @@ def _prompt(agent: AgentName) -> str:
|
|
| 204 |
"baseline evidence may be cited; for DELTA, compare only prior artifacts explicitly supplied "
|
| 205 |
"in optional_context and baseline_refs. Every evidence reference must copy the exact artifact "
|
| 206 |
"identity from the input and include either a JSON Pointer field_path or a supplied record_id. "
|
|
|
|
|
|
|
|
|
|
| 207 |
"For list-backed market data, use a visible zero-based JSON Pointer such as /ohlcv/0/close, "
|
| 208 |
"/indicators/points/0/rsi_14, or /news/0; never use a date as an array key, a negative or '-' "
|
| 209 |
"index, or a path that is not present in the typed input. "
|
|
|
|
| 204 |
"baseline evidence may be cited; for DELTA, compare only prior artifacts explicitly supplied "
|
| 205 |
"in optional_context and baseline_refs. Every evidence reference must copy the exact artifact "
|
| 206 |
"identity from the input and include either a JSON Pointer field_path or a supplied record_id. "
|
| 207 |
+
"If a direct dependency contains its own evidence_refs, do not copy a nested reference unless "
|
| 208 |
+
"that referenced artifact is separately supplied as an allowed source for this agent; otherwise "
|
| 209 |
+
"cite the containing record in the direct dependency artifact. "
|
| 210 |
"For list-backed market data, use a visible zero-based JSON Pointer such as /ohlcv/0/close, "
|
| 211 |
"/indicators/points/0/rsi_14, or /news/0; never use a date as an array key, a negative or '-' "
|
| 212 |
"index, or a path that is not present in the typed input. "
|
tests/test_quant_io_registry.py
CHANGED
|
@@ -45,6 +45,8 @@ def test_prompts_are_agent_specific_and_accept_only_typed_input():
|
|
| 45 |
assert "do not add routing fields" in binding.prompt_template
|
| 46 |
assert "for BASELINE, every delta_state must be NOT_COMPARED" in binding.prompt_template
|
| 47 |
assert "include either a JSON Pointer field_path" in binding.prompt_template
|
|
|
|
|
|
|
| 48 |
assert "use a visible zero-based JSON Pointer" in binding.prompt_template
|
| 49 |
|
| 50 |
event_prompt = quant_io_binding("MarketEventWatcher").prompt_template
|
|
|
|
| 45 |
assert "do not add routing fields" in binding.prompt_template
|
| 46 |
assert "for BASELINE, every delta_state must be NOT_COMPARED" in binding.prompt_template
|
| 47 |
assert "include either a JSON Pointer field_path" in binding.prompt_template
|
| 48 |
+
assert "do not copy a nested reference unless" in binding.prompt_template
|
| 49 |
+
assert "containing record in the direct dependency artifact" in binding.prompt_template
|
| 50 |
assert "use a visible zero-based JSON Pointer" in binding.prompt_template
|
| 51 |
|
| 52 |
event_prompt = quant_io_binding("MarketEventWatcher").prompt_template
|