Skip to content

fix: retain partial JSONL tails in watched sessions - #106

Merged
patoles merged 13 commits into
patoles:mainfrom
prashantpiyush1111:fix/issue-105-jsonl-tail
Oct 29, 2026
Merged

patoles merged 13 commits into
patoles:mainfrom
prashantpiyush1111:fix/issue-105-jsonl-tail

Conversation

@prashantpiyush1111

@prashantpiyush1111 prashantpiyush1111 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #105 by preserving incomplete JSONL records between successive file reads.

  • Adds fileTail to retain incomplete trailing JSONL data.
  • Updates session, subagent, event source, and relay watchers to preserve partial records.
  • Ensures partial data is retained when sessions move into worktree folders.
  • Adds regression tests for partial JSONL lines across multiple polling cycles.
  • Updates session relocation tests to handle file watchers correctly on Windows.

Closes #105

How to test

Run the following commands from the extension directory:

npx tsx --test "test/**/*.test.ts"
npx tsc --noEmit

Test results:

  • 77 tests passed.
  • 0 tests failed.
  • TypeScript compilation passed.

Checklist

  • I have read the CONTRIBUTING guide.
  • I have signed the CLA (to be completed through the CLA Assistant bot).

@cla-assistant

cla-assistant Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@prashantpiyush1111

Copy link
Copy Markdown
Contributor Author

Hi @patoles , I'm trying to sign the CLA, but the CLA Assistant page is not loading the agreement. Its /api/github/call requests are returning 401 Unauthorized.

Could you please check the CLA Assistant configuration or let me know if there is an alternative way to complete the CLA signing process?

Thank you!

@patoles

patoles commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Thanks for flagging this, and sorry for the hassle! It isn't you: cla-assistant.io itself has been having problems for the last week or so (other projects are reporting the same blank agreement page). The agreement itself is here: https://gist.github.com/patoles/dd124652ae56fb3bbf78f2a21ce6ff64

To keep things moving, could you read it and reply on this PR with "I have read the CLA document and I hereby sign the CLA"? That works as your signature for this PR. Once the service is back, feel free to sign through the bot link too so it's on file there. I'll review the changes in the meantime.

@patoles

patoles commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Thanks for the quick turnaround, this looks great! The fix matches the Codex watcher and the regression tests cover exactly the right cases. Two small things before it can go in:

  • pnpm --filter ./extension run lint:test fails because fileTail is now required: the session and subagent objects in test/transcript-parser.test.ts and test/transcript-parser-workflow.test.ts need fileTail: '' too.
  • scripts/relay.ts builds its own WatchedSession in watchSession() (around line 197). Could you add fileTail: '' there as well? It works without it thanks to the default parameter, but scripts/ isn't type-checked, so it slipped through.

That's all from my side. Thanks again!

@patoles
patoles merged commit 3489e17 into patoles:main Oct 29, 2026
1 check passed
@patoles

patoles commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Merged, thank you so much! This was a really nice catch, and the repro in #105 made it quick to confirm. Thanks also for turning the fixes around so fast. It will ship in the next release.

VladRd20 added a commit to VladRd20/agent-flow that referenced this pull request Nov 5, 2026
…es#96 patoles#97 patoles#98 patoles#99 patoles#56 patoles#103 patoles#104 patoles#106)

Conflict resolutions:
- hooks-config.ts / uninstall.js / .vscodeignore: take upstream's hook-entries
  refactor (supersedes our earlier partial port of the v0.9.2 hook fixes).
- app/src/server.ts: keep our read-only (GET/HEAD) + --host handling and add
  upstream's DNS-rebinding guard, adapted: loopback binds accept loopback Host
  only; LAN/WAN binds (--host 0.0.0.0) also accept IP-literal Hosts and names
  in AGENT_FLOW_ALLOWED_HOSTS (new isAllowedRemoteHost in request-guard.ts).
  Upstream's loopback-only check would have locked out remote/phone access.
- protocol.ts / event-source.ts: both sides added fileTail; keep our docs,
  add upstream's SubagentState.completed.
- timeline-panel.tsx: keep mobile maxHeight + upstream model hover handler.
- transcript-parser.test.ts add/add: ours kept, upstream's moved to
  transcript-parser-upstream.test.ts; upstream fixtures get pendingCatchUpSpawns.
- package.json test script: keep ours (cross-env, web/**) which is a superset.
@patoles patoles mentioned this pull request Nov 18, 2026
2 tasks done
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.

Transcript watchers drop events when a JSONL line is read before it is fully flushed (tail ignored)

2 participants