fix: each flush writes a separate partial bundle
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 78/100
Research direction
Start in src/agenttrace/tracer.py at AgentTracer.flush and trace how end_session writes the session bundle. Add a test that flushes, records more events, then calls end_session; confirm it produces one file containing every event and that verify passes.
Written by the indexing model from the issue text.
Description
AgentTracer.flush in src/agenttrace/tracer.py builds a new file name from the current time on every call and writes all events so far, so two flushes leave two overlapping bundles, and two flushes in the same second write to the same name. Pick the bundle path once per session and append only the events not yet written, so end_session finishes the same file. A test should flush, record more events, call end_session, and find one file that holds every event and passes verify.
Reproduced with:
$ cat flush_twice.py
import pathlib, time
from agenttrace import AgentTracer
t = AgentTracer(agent_id="a", output_dir="flushed")
t.start_session()
t.record_tool_call(tool="x")
t.flush()
time.sleep(1.1)
t.record_tool_call(tool="y")
t.end_session()
for p in sorted(pathlib.Path("flushed").glob("*.jsonl")):
print(p.name, sum(1 for _ in p.open()), "events")
$ python flush_twice.py
agenttrace_ad5bf52a_1792794772.jsonl 2 events
agenttrace_ad5bf52a_1792794773.jsonl 4 events
- Dominant language
- Python
- Stars
- 0
- Forks
- 1
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from obielin/agenttrace
-
enhancement good first issue
Difficulty 3/5 1-2 days Newbie friendliness 72/100
obielin/agenttrace#12 ·
-
enhancement help wanted
Difficulty 4/5 3-5 days Newbie friendliness 58/100
obielin/agenttrace#11 ·
-
enhancement help wanted
Difficulty 4/5 3-5 days Newbie friendliness 55/100
obielin/agenttrace#10 ·
-
help wanted refactor
Difficulty 3/5 1-2 days Newbie friendliness 69/100
obielin/agenttrace#9 ·
-
bug good first issue
Difficulty 3/5 1-2 days Newbie friendliness 78/100
obielin/agenttrace#7 ·
All issues in obielin/agenttrace
Similar issues
-
hive size:simple
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
A new VOLTTRON_HOME starts with agent isolation mode on (string comparison of a boolean default)Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
painted-porch/marcus#977 ·
Maintainers usually reply within 1 day
-
llm translation
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
FAIRmat-NFDI/sand#239 ·
Maintainers usually reply within 1 day