Skip to content

Fetch Copilot session event logs for optimization audits - #50071

Merged
pelikhan merged 2 commits into
mainfrom
copilot/copilot-opt-fix-missing-logs
Aug 3, 2026
Merged

pelikhan merged 2 commits into
mainfrom
copilot/copilot-opt-fix-missing-logs

Conversation

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Copilot optimization audits were operating on session metadata only because per-session events.jsonl/conversation logs were not populated. That blocked tool latency, payload size, validation timing, context size, and prompt drift analysis from using real telemetry.

  • Session telemetry fetch

    • Downloads non-expired workflow run artifacts for completed Copilot agent runs.
    • Extracts events.jsonl files as the preferred per-session data source.
    • Falls back to raw Actions job logs and [cca-engine] turn= transcript extraction when artifacts are unavailable.
  • Data-quality enforcement

    • Treats metadata-only cached data as stale when completed agent runs lack logs.
    • Emits ::error:: and exits non-zero when any completed agent run has neither events.jsonl nor transcript fallback.
    • Excludes in-progress runs from missing-log enforcement to avoid failing before logs/artifacts exist.
  • Workflow sync

    • Recompiled the affected Copilot analysis workflows so the shared fetch behavior is reflected in generated lock files.
/tmp/gh-aw/agent/session-data/logs/
  <run_id>-events.jsonl        # preferred structured session events
  <run_id>-conversation.txt    # fallback transcript from job logs

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing Copilot session logs from optimization data pipeline Fetch Copilot session event logs for optimization audits Aug 3, 2026
Copilot AI requested a review from pelikhan August 3, 2026 19:41
@pelikhan
pelikhan marked this pull request as ready for review August 3, 2026 20:08
Copilot AI review requested due to automatic review settings August 3, 2026 20:08
@pelikhan
pelikhan merged commit e4b0997 into main Aug 3, 2026
@pelikhan
pelikhan deleted the copilot/copilot-opt-fix-missing-logs branch August 3, 2026 20:08

Copilot AI left a comment

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.

Pull request overview

Adds structured Copilot session telemetry retrieval for optimization audits.

Changes:

  • Fetches events.jsonl artifacts with job-log fallback.
  • Enforces log completeness and cache freshness.
  • Regenerates affected workflow lock files.
Show a summary per file
File Description
.github/workflows/shared/copilot-session-data-fetch.md Implements telemetry fetching, validation, caching, and documentation.
.github/workflows/copilot-session-insights.lock.yml Regenerates Session Insights with shared fetch logic.
.github/workflows/copilot-opt.lock.yml Regenerates Copilot Opt with shared fetch logic and permissions.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 4
  • Review effort level: Balanced

Comment on lines +211 to +213
if [ "$AGENT_COUNT" -gt 0 ] && [ "$LOG_RUN_COUNT" -lt "$AGENT_COUNT" ]; then
echo "::error::Missing per-session logs for $((AGENT_COUNT - LOG_RUN_COUNT)) of $AGENT_COUNT agent runs; failing to prevent incomplete optimization analysis"
exit 1
Comment on lines +164 to +165
if [ -s "$events_tmp" ]; then
cp "$events_tmp" "$events_out"
rm -f "$events_tmp"
rm -rf "$artifact_work_dir"

if [ ! -s "$events_out" ]; then
Comment on lines +74 to +77
CACHED_AGENT_COUNT=$(jq '[.[] | select(.status == "completed" and .conclusion != "action_required")] | length' "$CACHE_DIR/copilot-sessions-${TODAY}.json")
CACHED_LOG_RUN_COUNT=$(count_agent_logs "$CACHE_DIR/copilot-sessions-${TODAY}.json" "$CACHE_DIR/session-logs-${TODAY}")
if [ "$CACHED_AGENT_COUNT" -eq 0 ] || [ "$CACHED_LOG_RUN_COUNT" -ge "$CACHED_AGENT_COUNT" ]; then
USE_CACHE=true
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.4

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.

[copilot-opt] Copilot session logs (events.jsonl) missing from optimization audit data pipeline

3 participants