Skip to content

Keep static_analysis.pkl across runs; add fresh_analysis input - #172

Open
Svilen-Stefanov wants to merge 2 commits into
mainfrom
feat/reuse-static-cache
Open

Svilen-Stefanov wants to merge 2 commits into
mainfrom
feat/reuse-static-cache

Conversation

@Svilen-Stefanov

Copy link
Copy Markdown
Contributor

Companion to CodeBoarding/CodeBoarding#691 (https://app.codeboarding.org/CodeBoarding/CodeBoarding/pull/691).

Why

Every engine release changes the config hash, so the Action found no saved analysis and rebuilt every LSP pass from scratch (crate: about 2 h). Full runs also passed --force, which threw the pkl away even when one was there.

What changes

  • Full runs keep the pkl. analyze_repository.py full deletes everything in .codeboarding except static_analysis.pkl / .sha and no longer passes --force.
  • fresh_analysis input ('false' by default; any value other than true/false fails the run). When true:
    • the published-base and warm-start fetch steps are skipped;
    • no seed is used;
    • the base runs full --fresh, which deletes everything and passes --force.
    • The PR head still runs incrementally from that new base, so component names line up and the review shows only real changes.
  • Cross-config pkl reuse. When nothing seeded the base, reuse_static_analysis takes only the pkl pair from the nearest codeboarding-base-*-<sha> artifact for the commit or an ancestor, under any config hash (find-ancestor-base.sh STATIC_ONLY=true). It does so only when .codeboardingignore matches the checkout, because the released Core keeps cached files regardless of ignore rules.

Release order

Safe with the Core the Action pins today: Core refuses a pkl with a different cache layout and rebuilds. Reuse in shallow clones pays off once a Core release with #691 is pinned.

Tests

  • python3 -m unittest discover -s tests: 358 OK, 7 skipped.
  • shellcheck -x clean.
  • Not run end to end on a real workflow.

🤖 Generated with Claude Code

Full runs now delete everything in .codeboarding except the pkl pair and no
longer pass --force, so Core's warm start reuses the LSP results. A new
`fresh_analysis` input ('true'/'false', validated) skips every saved analysis:
the published-base and warm-start fetch steps and the seeds are skipped and the
base runs `analyze_repository.py full --fresh`. The PR head stays incremental
from that base so component names line up.

When no saved analysis matches the current config hash (e.g. after an engine
release), the base takes only the pkl pair from the nearest commit or ancestor
artifact under any config, and only when its .codeboardingignore matches the
checkout, since the released Core keeps cached files regardless of ignore rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 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-14T18:54:54.490476Z 3b1cc3d 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.

@codeboarding-review

codeboarding-review Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

CodeBoarding review

Status: 1 changed component

See the full change in CodeBoarding.

graph LR
    n_Action_Analysis_and_Authentication_Tools["Action Analysis and Authentication Tools"]
    n_Remote_Review_and_Briefing_Sync["Remote Review and Briefing Sync"]
    n_Remote_Review_and_Briefing_Sync -- "authenticates requests via" --> n_Action_Analysis_and_Authentication_Tools
    classDef added fill:#1f883d,stroke:#0b5d23,color:#ffffff;
    classDef modified fill:#bf8700,stroke:#7d4e00,color:#ffffff;
    classDef deleted fill:#cf222e,stroke:#82071e,color:#ffffff,stroke-dasharray:5 3;
    class n_Action_Analysis_and_Authentication_Tools modified;
    linkStyle 0 stroke:#82071e,stroke-width:2px,stroke-dasharray:5 3;
Loading

download artifacts · run 43628749683

@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: b264199be5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread action.yml Outdated
- name: Fetch published base analysis
id: fetch_base
if: steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && steps.state.outputs.base_name != '' && github.server_url == 'https://github.com'
if: steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && steps.state.outputs.base_name != '' && github.server_url == 'https://github.com' && inputs.fresh_analysis != 'true'

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 Clear cached directories before skipping fresh fetches

When the action is invoked more than once in the same job, these fixed destinations can still contain the previous invocation's base and warm-start state. With fresh_analysis: 'true', both fetch steps are now skipped, so fetch-state.sh never performs its existing cleanup; review-generate-baseline.sh can then accept the stale BASE_DIR in compatible_state before reaching its fresh-analysis branch, silently violating the promise to rebuild from scratch. Ensure the directories are cleared even when these fetches are disabled, and likewise prevent the stale warm start from being considered.

Useful? React with 👍 / 👎.

Comment thread scripts/action/seed-sources.sh Outdated
Comment on lines +85 to +88
if { [ -e "$dest/.codeboardingignore" ] || [ -e "$state/.codeboardingignore" ]; } &&
! cmp -s "$dest/.codeboardingignore" "$state/.codeboardingignore"; then
echo "::notice::The saved static analysis of ${ancestor:0:7} was made with another .codeboardingignore; not reusing it."
return 0

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 Try older caches after an ignore mismatch

When the nearest saved artifact has different ignore rules, this returns without trying any older candidate. For example, if .codeboardingignore changed and was later reverted, the nearest ancestor's cache is rejected here even though the next ancestor may exactly match the current rules; the ensuing full run therefore rebuilds the language-server cache from scratch, which this change is specifically intended to avoid and can add hours on large repositories. Continue searching older saved bases after rejecting a candidate.

Useful? React with 👍 / 👎.

@ivanmilevtues ivanmilevtues left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One comment only we use Force for this thing in the core. Maybe fresh is a better descriptior, but eitehr way I think it would be best if we unify the API between the core and here so that it is less confusing in general (both for us and agents).

from threading import Thread

PROG = "codeboarding"
STATIC_CACHE = {"static_analysis.pkl", "static_analysis.sha"}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We have a warning on this, that we have hardcoded it multiple times.

parser.add_argument("--output-dir", required=True, help="Action-owned output directory")
parser.add_argument("--depth-cap", help="Maximum hierarchy depth allowed for full analyses")
parser.add_argument(
"--fresh", action="store_true", help="Full analysis from nothing, not even the static-analysis cache"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

in the core isn't this the --force parameter, i would suggest to keep the same paramtere name so it is less confusing

str(output_dir),
"--depth-cap",
args.depth_cap,
"--force",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

effectively this parameter for my comment from above.

Comment thread action.yml
description: 'Positive integer analysis depth cap, used for both review and sync, including full fallbacks.'
required: false
default: '2'
fresh_analysis:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i am fine with fresh, although i am not sure this is the proper lingo, it sounds a bit odd.
I am more used to things like invalidate/force ;d, we can keep it fresh as well just mentioning. And it doesn't align with our core lingo where I think we call this force

The .codeboardingignore guard compared the file inside the saved bundle with
the checkout's, but the base uploads drop dotfiles (include-hidden-files is
false), so the bundle never had one. A repo that commits an ignore file always
rebuilt; one without reused with no check. Core reads the rules from the
checkout's .codeboarding/.codeboardingignore, so the guard now asks git whether
that file differs between the commit the analysis describes and this one. A
commit not in the checkout counts as different. Published bundles need no
change.

A fresh run also clears the fixed fetch directories: run twice in one job, the
second use would otherwise inherit the first one's saved state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Svilen-Stefanov added a commit that referenced this pull request Nov 14, 2026
…nt ones

Core reads the previous analysis from where it writes the new one, so the file
being there after a full run proved nothing: a run that wrote nothing would
publish the lent analysis, possibly another configuration's, as its own. The
check now compares the file before and after; every analysis Core writes
carries its own generated_at.

The any-configuration lookup on the baseline branch is best effort, but a
failed read there ran baseline_fail and failed the run. With CFG_HASH='*' a
read failure now warns and the lookup falls through, as the artifact lookup
does; a lookup for this configuration still fails loudly.

Carries #172's ignore-rule and fetch-directory fixes unchanged, so the rebase
onto it drops them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Svilen-Stefanov added a commit that referenced this pull request Nov 14, 2026
Brings in #172's review fix; #173 already carries the same ignore check in
reuse_other_configuration, so its side of seed-sources.sh stands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants