Skip to content

fix(agenthook): link Cursor and Antigravity pull requests for PR comments - #365

Merged
AnnatarHe merged 2 commits into
mainfrom
fix/agenthook-pr-comments
Nov 28, 2026
Merged

AnnatarHe merged 2 commits into
mainfrom
fix/agenthook-pr-comments

Conversation

@AnnatarHe

@AnnatarHe AnnatarHe commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Previously, only Claude Code (via shelltime cc pr from claude-code-mods) triggered POST /api/v1/cc/session-pull-requests when a pull request was created. Cursor and Google Antigravity hook events (postToolUse / PostToolUse) never extracted created PR URLs or called the PR linking endpoint.

Changes

  • agenthook/pr.go, agenthook/cursor.go, agenthook/antigravity.go, agenthook/event.go:
    • Detect successful gh pr create shell calls and GitHub MCP create_pull_request tool calls.
    • Extract only normalized PR URLs from Cursor's tool_output / tool_response (stdout-only when structured; ignoring errors and non-zero exit codes; raw tool output is still never stored) and Antigravity's direct output fields or transcript.jsonl step matching stepIdx.
    • Carry them in daemon-only Event.PullRequestURLs.
  • model/agent_hook_privacy.go, model/api_agent_hooks.go:
    • Clear PullRequestURLs when a command matches exclude patterns; keep PR linking working when agentHooks.sendContent is false.
    • Strip daemon-only fields (YieldToUserHooks, PullRequestURLs) before POST /api/v1/agent-hooks.
  • daemon/agent_hooks.go, daemon/agent_hooks_resync.go:
    • Dispatch model.SendSessionPullRequests (POST /api/v1/cc/session-pull-requests) after each flushed or resynced chunk succeeds, using the daemon's resolved SessionID (including lent session IDs when Cursor omits conversation_id), deduplicated per (sessionID, url) within agentHookSessionTTL, and preserving PullRequestURLs on retryable failures saved to agent-hooks.pending.jsonl.
  • Tests & Docs: Added agenthook/pr_test.go, daemon batcher/resync tests, privacy/wire tests, and updated README.md / CLAUDE.md.

Test Evidence

  • go fmt ./... && go vet ./... passed
  • go build ./cmd/cli/main.go and go build ./cmd/daemon/main.go passed
  • go test -timeout 3m -coverprofile=coverage.txt -covermode=atomic ./... passed
  • go test -race ./agenthook/... ./daemon/... passed

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T13:47:29.256549Z f9d8a14 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

⏱️ shelltime track performance

✅ No significant change in shelltime track latency

Comparing main @ 3521be0 → #365 @ f9d8a14. Each scenario execs the binary the way the shell hooks do; values are the median of 10 interleaved rounds. Lower is better.

Scenario base head Δ p
Startup/floor 316 µs ±1% 316 µs ±2% ~ 0.853 A/A
Startup/version 3.27 ms ±1% 3.25 ms ±2% ~ 0.280 ✅
Track/daemon/pre 3.44 ms ±1% 3.41 ms ±1% ~ 0.218 ✅
Track/daemon/post 3.41 ms ±1% 3.40 ms ±2% ~ 0.218 ✅
Track/direct/pre 3.42 ms ±2% 3.38 ms ±1% -1.13% 0.005 ✅
Track/direct/post 4.66 ms ±1% 4.69 ms ±2% ~ 0.436 ✅
Track/direct/post-sync 6.69 ms ±1% 6.71 ms ±2% ~ 0.912 ✅

Binary size: 23.6 MiB → 23.6 MiB (+0.0%).

CPU, tail latency and memory

Per exec, base → head (Δ when significant).

Scenario p95 wall user CPU sys CPU peak RSS
Startup/floor 376 µs → 380 µs 227 µs → 229 µs 53 µs → 52 µs 9.2 MiB → 9.3 MiB
Startup/version 3.52 ms → 3.49 ms 1.52 ms → 1.56 ms (+2.70%) 2.13 ms → 2.09 ms (-1.97%) 17.1 MiB → 16.9 MiB (-1.00%)
Track/daemon/pre 3.66 ms → 3.65 ms 1.71 ms → 1.79 ms (+4.60%) 2.15 ms → 2.05 ms (-4.63%) 17.6 MiB → 17.5 MiB (-0.37%)
Track/daemon/post 3.63 ms → 3.62 ms 1.66 ms → 1.71 ms 2.17 ms → 2.09 ms 17.5 MiB → 17.2 MiB (-1.66%)
Track/direct/pre 3.64 ms → 3.60 ms (-0.93%) 1.73 ms → 1.64 ms 2.10 ms → 2.12 ms 17.5 MiB → 17.4 MiB (-0.56%)
Track/direct/post 4.90 ms → 4.90 ms 2.68 ms → 2.63 ms 2.48 ms → 2.53 ms 18.0 MiB → 17.8 MiB (-0.83%)
Track/direct/post-sync 7.10 ms → 7.08 ms 4.91 ms → 4.86 ms 3.83 ms → 3.84 ms 20.6 MiB → 20.8 MiB (+0.88%)
benchstat
goos: linux
goarch: amd64
pkg: github.com/malamtime/cli/perf
cpu: Intel(R) Xeon(R) 6975P-C
                         │    base     │                head                │
                         │   sec/op    │   sec/op     vs base               │
Startup/floor-4            315.6µ ± 1%   315.8µ ± 2%       ~ (p=0.853 n=10)
Startup/version-4          3.268m ± 1%   3.252m ± 2%       ~ (p=0.280 n=10)
Track/daemon/pre-4         3.444m ± 1%   3.414m ± 1%       ~ (p=0.218 n=10)
Track/daemon/post-4        3.415m ± 1%   3.403m ± 2%       ~ (p=0.218 n=10)
Track/direct/pre-4         3.420m ± 2%   3.381m ± 1%  -1.13% (p=0.005 n=10)
Track/direct/post-4        4.659m ± 1%   4.687m ± 2%       ~ (p=0.436 n=10)
Track/direct/post-sync-4   6.688m ± 1%   6.707m ± 2%       ~ (p=0.912 n=10)
geomean                    2.783m        2.775m       -0.27%

                         │    base     │                head                │
                         │ p50-sec/op  │ p50-sec/op   vs base               │
Startup/floor-4            303.9µ ± 2%   303.5µ ± 1%       ~ (p=0.739 n=10)
Startup/version-4          3.255m ± 1%   3.238m ± 1%       ~ (p=0.218 n=10)
Track/daemon/pre-4         3.413m ± 1%   3.411m ± 1%       ~ (p=0.912 n=10)
Track/daemon/post-4        3.403m ± 2%   3.382m ± 1%       ~ (p=0.123 n=10)
Track/direct/pre-4         3.411m ± 1%   3.369m ± 2%  -1.22% (p=0.015 n=10)
Track/direct/post-4        4.643m ± 1%   4.656m ± 1%       ~ (p=0.853 n=10)
Track/direct/post-sync-4   6.686m ± 1%   6.755m ± 2%       ~ (p=0.684 n=10)
geomean                    2.759m        2.754m       -0.18%

                         │    base     │                head                │
                         │ p95-sec/op  │ p95-sec/op   vs base               │
Startup/floor-4            375.7µ ± 8%   380.4µ ± 6%       ~ (p=0.529 n=10)
Startup/version-4          3.523m ± 3%   3.489m ± 2%       ~ (p=0.218 n=10)
Track/daemon/pre-4         3.662m ± 2%   3.646m ± 1%       ~ (p=0.280 n=10)
Track/daemon/post-4        3.629m ± 1%   3.624m ± 2%       ~ (p=0.280 n=10)
Track/direct/pre-4         3.638m ± 3%   3.604m ± 1%  -0.93% (p=0.005 n=10)
Track/direct/post-4        4.898m ± 3%   4.904m ± 2%       ~ (p=0.796 n=10)
Track/direct/post-sync-4   7.102m ± 1%   7.080m ± 1%       ~ (p=0.912 n=10)
geomean                    3.008m        3.001m       -0.20%

                         │     base     │                head                 │
                         │  peak-rss-B  │  peak-rss-B   vs base               │
Startup/floor-4            9.239Mi ± 1%   9.273Mi ± 1%       ~ (p=0.671 n=10)
Startup/version-4          17.09Mi ± 0%   16.91Mi ± 0%  -1.00% (p=0.000 n=10)
Track/daemon/pre-4         17.57Mi ± 0%   17.50Mi ± 0%  -0.37% (p=0.000 n=10)
Track/daemon/post-4        17.52Mi ± 0%   17.23Mi ± 0%  -1.66% (p=0.000 n=10)
Track/direct/pre-4         17.51Mi ± 0%   17.41Mi ± 0%  -0.56% (p=0.000 n=10)
Track/direct/post-4        17.99Mi ± 0%   17.85Mi ± 0%  -0.83% (p=0.000 n=10)
Track/direct/post-sync-4   20.60Mi ± 0%   20.78Mi ± 0%  +0.88% (p=0.000 n=10)
geomean                    16.37Mi        16.30Mi       -0.45%

                         │     base     │                head                 │
                         │  sys-sec/op  │  sys-sec/op   vs base               │
Startup/floor-4            53.27µ ± 29%   51.80µ ± 14%       ~ (p=0.912 n=10)
Startup/version-4          2.127m ±  4%   2.085m ±  5%  -1.97% (p=0.043 n=10)
Track/daemon/pre-4         2.146m ±  5%   2.047m ±  4%  -4.63% (p=0.015 n=10)
Track/daemon/post-4        2.167m ±  5%   2.092m ±  7%       ~ (p=0.075 n=10)
Track/direct/pre-4         2.101m ±  7%   2.121m ±  8%       ~ (p=0.631 n=10)
Track/direct/post-4        2.476m ±  6%   2.529m ±  5%       ~ (p=0.280 n=10)
Track/direct/post-sync-4   3.832m ±  2%   3.841m ±  6%       ~ (p=0.631 n=10)
geomean                    1.399m         1.380m        -1.38%

                         │     base     │                head                │
                         │ user-sec/op  │ user-sec/op  vs base               │
Startup/floor-4            226.8µ ±  6%   228.9µ ± 4%       ~ (p=0.853 n=10)
Startup/version-4          1.522m ±  4%   1.563m ± 4%  +2.70% (p=0.029 n=10)
Track/daemon/pre-4         1.708m ± 11%   1.786m ± 7%  +4.60% (p=0.011 n=10)
Track/daemon/post-4        1.660m ±  9%   1.706m ± 7%       ~ (p=0.481 n=10)
Track/direct/pre-4         1.728m ± 10%   1.637m ± 7%       ~ (p=0.971 n=10)
Track/direct/post-4        2.679m ±  5%   2.629m ± 4%       ~ (p=0.315 n=10)
Track/direct/post-sync-4   4.906m ±  2%   4.860m ± 2%       ~ (p=0.579 n=10)
geomean                    1.557m         1.563m       +0.37%

Δ compares medians; ~ means no significant difference (Mann-Whitney U, p ≥ 0.05). A scenario is flagged when it is more than 10% and more than 250µs slower with p < 0.05. Startup/floor runs true, not shelltime: it is an A/A check of runner noise. Runner: linux/amd64, Intel(R) Xeon(R) 6975P-C. go1.27.1, 10 rounds × 100 execs per scenario and binary.

Comment thread daemon/agent_hooks.go
for start := 0; start < len(fresh); start += maxSessionPullRequestsPerRequest {
end := min(start+maxSessionPullRequestsPerRequest, len(fresh))
part := fresh[start:end]
if err := b.sendPullRequests(ctx, cfg, batch.sessionID, part); err != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important: a failed PR link is lost for good. The events were already accepted by /api/v1/agent-hooks, so nothing is saved or retried. A transient failure, such as a 5xx, a timeout, or a 404 from an older server, drops the link, and the same happens in dispatchSessionPullRequests in the resync. Linking is also only attempted when the whole hook chunk succeeded, so a chunk the server refused (the "dropped" branch) never links its PRs either.

Fix: when the link request fails with a retryable error, keep the PR URLs. For example, save a PR-only event to the pending file, or keep a retry queue. Do not mark them sent, and do not drop them.

Comment thread agenthook/pr.go Outdated
var (
// ghPRCreatePattern finds `gh pr create` in a shell command, including when chained
// or quoted inside `bash -lc "..."`.
ghPRCreatePattern = regexp.MustCompile(`(?:^|[\s;&|("'])gh\s+pr\s+create\b`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit (optional): isPRCreateToolCall only checks that gh pr create appears somewhere in the command, and then every pull request URL in the output is linked. gh pr create ... && gh pr list, gh pr create || gh pr view --web, or a script that prints other PR URLs would link PRs the session did not open. A plain-string tool_output also carries no stdout/stderr split. For a chained command, prURLPattern is applied to the whole output.

Fix: link only the last URL, or only a URL on a line of its own, for string output. Alternatively, restrict this to commands where gh pr create is the last or only segment.

Comment thread agenthook/pr.go
// for step_index == stepIdx and extracts pull request URLs from its output fields (never its
// command arguments or stderr). Missing, unreadable, non-regular, or unflushed transcripts
// return nil so hook recording never fails or blocks.
func extractAntigravityTranscriptPRURLs(transcriptPath string, stepIdx int) []string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit (optional): extractAntigravityTranscriptPRURLs copies about 80 lines from usage in agenthook/antigravity_transcript.go: the stat/open/re-stat guards, the chunked backward scan, the carry handling, and the consecutiveBelow stop. Any fix to the scan, such as a carry edge case or a scan cap, now has to be made twice. The shipped copy also reads the file a second time for each PostToolUse in hook-ingest, a latency-sensitive path.

Fix: factor the shared backward line scanner into one helper that takes a per-line callback. Both the usage code and this function would use it.

@codecov

codecov Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.95706% with 36 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
agenthook/pr.go 82.30% 23 Missing ⚠️
agenthook/antigravity_transcript.go 79.48% 8 Missing ⚠️
daemon/agent_hooks.go 96.00% 5 Missing ⚠️
Flag Coverage Δ
unittests 86.05% <88.95%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
agenthook/antigravity.go 100.00% <100.00%> (ø)
agenthook/cursor.go 96.66% <100.00%> (+0.07%) ⬆️
agenthook/event.go 100.00% <ø> (ø)
daemon/agent_hooks_resync.go 87.95% <100.00%> (+1.28%) ⬆️
model/agent_hook_privacy.go 100.00% <100.00%> (ø)
model/api_agent_hooks.go 92.72% <100.00%> (+2.25%) ⬆️
daemon/agent_hooks.go 96.48% <96.00%> (-0.74%) ⬇️
agenthook/antigravity_transcript.go 86.70% <79.48%> (+0.31%) ⬆️
agenthook/pr.go 82.30% <82.30%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread daemon/agent_hooks.go
if err == nil {
sent += len(chunk)
b.dispatchPullRequests(ctx, cfg, collectSessionPullRequests(chunk))
continue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important: aiCodeOtel.sendRepository: false no longer turns off everything about repositories. prepareAgentHookEvents clears only ev.Repository when it is off, but PullRequestURLs (owner/repo/number) still reach the server through dispatchPullRequests here and dispatchSessionPullRequests in the resync service. CLAUDE.md says sendRepository: false "turns all of it off".

Fix: in prepareAgentHookEvents, set ev.PullRequestURLs = nil when !sendsRepository. Alternatively, skip dispatch under that setting, and add a test.

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

Copy link
Copy Markdown

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: ea871706c8

ℹ️ 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 thread agenthook/pr.go
Comment on lines +151 to +152
for _, k := range keys {
collectPullRequestURLsFromRaw(obj[k], seen, out)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Extract only the created PR from structured MCP responses

When a create_pull_request response includes a PR body referencing another PR, recursively scanning every non-ignored field collects both the created PR's html_url and the referenced URL. For example, a response with html_url ending in /pull/42 and body containing /pull/10 produces both URLs; this was reproduced against the normalizer. The daemon then submits both to the session-linking endpoint, incorrectly attributing an existing PR to this session. Prefer the structured response's canonical PR URL instead of scanning arbitrary fields such as body.

Useful? React with 👍 / 👎.

Comment thread daemon/agent_hooks.go
Comment on lines +382 to +385
if err := b.sendPullRequests(ctx, cfg, batch.sessionID, part); err != nil {
slog.Warn("Failed to send agent hook session pull requests",
slog.String("sessionId", batch.sessionID), slog.Int("count", len(part)), slog.Any("err", err))
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve PR links when their separate request fails

If the agent-hooks upload succeeds but the subsequent PR-link request times out, returns a retryable server error, or is canceled during daemon shutdown, this branch only logs the error and discards the URLs. flush has already removed the events from pending, so nothing reaches the pending file for resync, and the successful hook upload omitted these URLs. The resync dispatcher similarly discards failed links before removing the saved events. Preserve retryable PR-link failures independently, or retain the corresponding events until linking succeeds, so a transient failure does not permanently lose the association.

Useful? React with 👍 / 👎.

Comment thread agenthook/pr.go
return false
}

func appendPullRequestURLs(text string, seen map[string]bool, out *[]string) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important: a plain-text tool_output is scanned for every pull request URL in it, not only the one gh pr create created. In a chained command such as gh pr view 12 && gh pr create --fill, gh pr list && gh pr create or gh pr create && gh pr merge, the output holds the other PR's URL too. The event then links PR 12 (or whatever else was printed) to the session along with the new one. The same applies to the Antigravity transcript output path and to string values reached through collectPullRequestURLsFromRaw. Fix: for gh pr create, take only the URL that gh printed last (it prints the new PR URL as the final stdout line), or only the first match when the command is a single gh pr create and no other gh pr subcommand is chained.

Comment thread agenthook/pr.go
// ghPRCreatePattern finds `gh pr create` in a shell command, including when chained
// or invoked via a shell `-c` wrapper (`bash -lc "gh pr create ..."`), without matching
// arbitrary quoted text such as `echo "gh pr create"`.
ghPRCreatePattern = regexp.MustCompile(`(?:^|[\s;&|(]|-[a-zA-Z]*c\s+["'])gh\s+pr\s+create\b`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit (optional): ghPRCreatePattern requires the literal gh pr create, so valid forms never link a PR. Examples are gh --repo owner/repo pr create, gh -R owner/repo pr create, an absolute path such as /opt/homebrew/bin/gh pr create (the preceding / isn't in the allowed prefix class), and `gh pr create` or { gh pr create; } wrappers. The cost is a silently missing PR link, and agents often run gh -R in cloud sandboxes. Fix: allow gh options between gh and pr (e.g. gh(?:\s+-{1,2}[\w-]+(?:[=\s]+\S+)?)*\s+pr\s+create) and accept / and a backtick in the prefix class.

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

Copy link
Copy Markdown

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: f9d8a14b4e

ℹ️ 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 thread agenthook/pr.go
// ghPRCreatePattern finds `gh pr create` in a shell command, including when chained
// or invoked via a shell `-c` wrapper (`bash -lc "gh pr create ..."`), without matching
// arbitrary quoted text such as `echo "gh pr create"`.
ghPRCreatePattern = regexp.MustCompile(`(?:^|[\s;&|(]|-[a-zA-Z]*c\s+["'])gh\s+pr\s+create\b`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Exclude quoted arguments when detecting PR-creation commands

When a shell tool prints or searches text containing gh pr create after a space inside a quoted argument, this pattern incorrectly treats it as an executed PR-creation command. For example, printf '%s\n' 'Example: gh pr create https://github.com/acme/web/pull/12' matches the pattern and emits a URL that the normalizer extracts, so the daemon links PR 12 to the session even though no PR was created. Detect shell command positions rather than arbitrary whitespace-delimited occurrences, while preserving support for shell wrappers.

Useful? React with 👍 / 👎.

Comment thread daemon/agent_hooks.go
return retry
}

func (b *AgentHookBatcher) dispatchPullRequests(ctx context.Context, cfg model.ShellTimeConfig, batches []sessionPullRequestBatch) map[agentHookPRKey]bool {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit (optional): dispatchPullRequests repeats dispatchSessionPullRequests below (in daemon/agent_hooks.go) almost line for line: the chunking by maxSessionPullRequestsPerRequest, the warn-and-collect-retryable block, and the debug log. The two differ only in the sentPRs dedupe. stripDaemonOnlyHookEvents repeats model.stripDaemonOnlyAgentHookEvents, and since SendAgentHookEvents now strips itself, the daemon strips twice, copying the slice both times. Fix: keep one strip (in model) and have the batcher's dedupe filter the batches before calling the shared dispatcher. The two copies will drift.

Comment thread daemon/agent_hooks.go
return retry
}

func (b *AgentHookBatcher) dispatchPullRequests(ctx context.Context, cfg model.ShellTimeConfig, batches []sessionPullRequestBatch) map[agentHookPRKey]bool {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pre-existing-style concern (not blocking): dispatchPullRequests runs inside flush, synchronously and once per chunk, with a 5 s HTTP timeout for each session and 20-URL part. A slow /api/v1/cc/session-pull-requests delays the next chunk's agent-hooks send and holds the single flush goroutine, so unrelated hook events queue behind it. A failure that isn't agentHookSendCanWait (any other 4xx) is only logged. The link is lost for good while the event itself counts as sent. Fix: consider retrying on any non-4xx-validation failure, and doing the PR links after all chunks are sent so a slow endpoint can't delay hook delivery.

@AnnatarHe
AnnatarHe merged commit 8685792 into main Nov 28, 2026
16 checks passed
@AnnatarHe
AnnatarHe deleted the fix/agenthook-pr-comments branch November 28, 2026 13:48
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