mpfaffenberger / mpfaffenberger/code_puppy_core_plugins

timestamp_heartbeat: single module-global counter is shared across all concurrent agents/sessions

Open
#28 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3
Forks
20
Avg merge
2d 3h
Merged PRs (30d)
20

Description

Bug

timestamp_heartbeat/register_callbacks.py — lines 41–42, 83–98.

_calls_since_stamp / _stamp_due are module-level and incremented by every post_tool_call, regardless of which agent or session the tool call belongs to. The bundle explicitly supports concurrent background runs (fork, subagent_panel, steer_queue run agents on the same loop).

With interval = 10: a background fork rattling off tool calls will advance the shared counter and fire a timestamp into whichever result is next — not necessarily the current agent's conversation. The "periodic clock tick" for the foreground session fires at an unpredictable cadence (or never, if a chatty fork keeps tripping the counter), and a __SYS_TIMESTAMP__ can land in someone else's transcript.

The inline comment "no locking theater needed" is correct only about concurrency safety, not semantic isolation.

Suggested fix

Key the counters by agent session id (the post_tool_call args carry context/session info), or at least by executing agent name.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in timestamp_heartbeat/register_callbacks.py lines 41–42 and 83–98, then inspect the post_tool_call arguments for the available session or agent identifier. Trace how concurrent runs are represented and identify existing tests or callback fixtures before choosing the key. Done means each agent or session reaches its own interval and SYS_TIMESTAMP is only added to that session’s result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.