Skip to content

Automatically expire stale Pending node entries - #8173

Open
Amaury Chamayou (achamayou) with Copilot wants to merge 9 commits into
mainfrom
copilot/ccf-6672-node-expire-pending-entries
Open

Automatically expire stale Pending node entries#8173
Amaury Chamayou (achamayou) with Copilot wants to merge 9 commits into
mainfrom
copilot/ccf-6672-node-expire-pending-entries

Conversation

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Unsuccessful join attempts can leave Pending node records requiring manual operator cleanup. This adds configurable, primary-driven expiration.

  • Expiration

    • Persist each Pending node’s admission timestamp.
    • Periodically remove entries older than pending_node_timeout.
    • Remove associated certificates and sealed recovery data.
  • Configuration

    • Default timeout: 24h.
    • Set 0s to disable cleanup.
{
  "pending_node_timeout": "6h"
}
  • Compatibility

    • Initialize timestamps for legacy Pending entries on first inspection.
    • Reset invalid or future timestamps to avoid premature deletion.
    • Preserve timestamps across restart and primary failover.
  • Integration

    • Add host configuration schema and operator documentation.
    • Add focused unit and end-to-end coverage.

Copilot AI changed the title [WIP] Add automatic expiration for KV pending entries after delay Automatically expire stale Pending node entries Aug 18, 2026
Copilot AI and others added 3 commits August 24, 2026 14:56
Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@achamayou
Amaury Chamayou (achamayou) force-pushed the copilot/ccf-6672-node-expire-pending-entries branch from b1a16f8 to f8929e7 Compare August 26, 2026 12:07
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@achamayou

Copy link
Copy Markdown
Member

Copilot resolve the merge conflicts in this pull request

…-expire-pending-entries

# Conflicts:
#	tests/e2e_operations.py

Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>

Copilot AI commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

Resolved in 2d663ef by merging the latest main and retaining the pending-node expiration test in the new operations configuration runner.

@achamayou
Amaury Chamayou (achamayou) marked this pull request as ready for review September 3, 2026 13:49
@achamayou
Amaury Chamayou (achamayou) requested a review from a team as a code owner September 3, 2026 13:49

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.

🟡 Changes recommended

Timestamp throttling can expire active joiners early, while the default and changelog placement conflict with stated requirements.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds primary-driven expiration of stale Pending node records, including configuration, persistence, cleanup, documentation, and tests.

Changes:

  • Records and refreshes Pending-node timestamps.
  • Periodically removes expired nodes and associated data.
  • Adds host configuration, documentation, and test coverage.

Custom instructions used:

  • .github/copilot-instructions.md
  • .github/instructions/changelog.instructions.md
  • .github/instructions/reviewing.instructions.md
File summaries
File Description
tests/infra/remote.py Passes timeout into node configuration.
tests/infra/network.py Forwards the new test argument.
tests/e2e_operations.py Tests automatic expiration end-to-end.
tests/config.jinja Renders the timeout setting.
src/node/rpc/test/node_stub.h Adds configurable test subsystems.
src/node/rpc/test/node_frontend_test.cpp Tests timestamp and cleanup behavior.
src/node/rpc/test/frontend_test.cpp Reuses the shared configuration stub.
src/node/rpc/node_frontend.h Tracks timestamps and removes expired entries.
src/node/pending_node_cleanup.h Implements periodic primary cleanup.
src/node/node_state.h Starts the cleanup task.
src/common/configuration.h Registers configuration serialization.
include/ccf/service/node_info.h Persists the last-seen timestamp.
include/ccf/node/startup_config.h Defines the timeout default.
doc/operations/start_network.rst Documents expiration behavior.
doc/host_config_schema/host_config.json Adds the host configuration schema.
CHANGELOG.md Announces the feature.
Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread include/ccf/node/startup_config.h
Comment on lines +610 to +616
const auto refresh_interval =
pending_node_timeout.value().count() / 2;
if (
!node_info->pending_last_seen.has_value() ||
node_info->pending_last_seen.value() < 0 ||
node_info->pending_last_seen.value() > now ||
now - node_info->pending_last_seen.value() >= refresh_interval)
Comment thread CHANGELOG.md Outdated
Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.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.

Node Pending entries in the KV should automatically expire after a configurable delay

3 participants