Skip to content

feat: add tape recording system for workspace analyze sessions#30

Open
STRRL wants to merge 1 commit intomasterfrom
tape-opus-4.6
Open

feat: add tape recording system for workspace analyze sessions#30
STRRL wants to merge 1 commit intomasterfrom
tape-opus-4.6

Conversation

@STRRL
Copy link
Owner

@STRRL STRRL commented Mar 20, 2026

Implement a Go port of republic's tape system that records agent
execution as append-only JSONL entries. Each workspace analyze run
generates a .tape.jsonl file capturing messages, tool calls, results,
errors, and events with token usage metadata.

  • pkg/tape: entry model, JSONL store, eino callback handler, slog handler
  • Integrate JSONL tape recorder in analyzer via Config.TapePath
  • Register slog tape handler globally in main.go for live logging

Implement a Go port of republic's tape system that records agent
execution as append-only JSONL entries. Each workspace analyze run
generates a .tape.jsonl file capturing messages, tool calls, results,
errors, and events with token usage metadata.

- pkg/tape: entry model, JSONL store, eino callback handler, slog handler
- Integrate JSONL tape recorder in analyzer via Config.TapePath
- Register slog tape handler globally in main.go for live logging
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 311196d385

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +110 to +113
if config.TapePath != "" {
jsonlStore := tape.NewJSONLStore(config.TapePath)
callbacks.AppendGlobalHandlers(tape.NewHandler(jsonlStore))
slog.Info("Tape recording enabled", "path", config.TapePath)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid appending tape callbacks to global handler state

RunAgentWithPrompt installs a new tape callback via callbacks.AppendGlobalHandlers on every invocation, but global handlers are process-wide and never removed. If this function is called more than once in a process (e.g., repeated analyzer runs in tests or embedded usage), later runs will invoke all previously registered tape handlers, causing duplicated events and writes to stale tape files from earlier sessions.

Useful? React with 👍 / 👎.

func NewJSONLStore(path string) *JSONLStore {
return &JSONLStore{
path: path,
nextID: 1,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve unique entry IDs when appending to existing tape

The store always starts nextID at 1, but writes are append-only, so rerunning workspace analyze against an existing .tape.jsonl file creates duplicate IDs in the same tape. Any consumer that relies on Entry.ID uniqueness or monotonic ordering will get ambiguous records after the first rerun.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant