Skip to content

fix: guardrail version quota, credentials race, late reconciler writes; CI cleanup - #1084

Merged
krokoko merged 11 commits into
mainfrom
fix/1073-1079-1080-reconciler-guardrail-credentials
Nov 26, 2026
Merged

krokoko merged 11 commits into
mainfrom
fix/1073-1079-1080-reconciler-guardrail-credentials

Conversation

@krokoko

@krokoko krokoko commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Three fixes, the removal of the unused deploy and integ pipeline, and a move of the AWS Emulator pin. They are on one branch because the repository owner asked for them together. Each has a commit of its own.

Area

  • cdk — infrastructure, handlers, constructs
  • agent — Python runtime / Docker image
  • cli — bgagent client
  • docs — guides or design sources (docs/guides/, docs/design/)
  • tooling — root mise.toml, scripts, CI workflows

Related

Closes #1080
Closes #1079
Closes #1073

The removal of the workflows and the emulator update have no issue: the repository owner asked for both directly. The cause of #1079 is reported upstream as aws/aws-cdk#38674.

Changes

#1080: a valid login reported as corrupt (cli/src/config.ts)

  • writeSecretFile truncated the file and then wrote it, so a second bgagent process could read an empty or partial credentials.json. It now writes a temporary file beside the target (created exclusively, mode 0600) and renames it over the target.
  • The function is shared: invite files, pending Linear consents and replay --output are written the same way. A device, a FIFO and a symbolic link are still written in place.
  • Measured with real processes (one saving, four reading): thousands of reads reported "corrupt" before, none after.

#1079: deploys stop at the guardrail's version quota (cdk/src/stacks/agent.ts)

  • Cause: createVersion() of the alpha library names the version after an unresolved token, and aws-cdk-lib starts its token counter at a random number. About nine deploys in ten therefore replaced the version, and since feat(compute): add Lambda MicroVM P3 approval lifecycle #904 the replaced one is retained. A real change of the guardrail was published only by the same chance.
  • The stack now creates the version itself, named after a hash of the guardrail's CloudFormation properties (without tags) and of the description. Synthesis fails if the guardrail is changed after its version was published.
  • No cleanup job: with a stable name a version is published only when the guardrail changes.

#1073: a late write puts a failed sub-task's issue back to not started (cdk/src/handlers/orchestration-reconciler.ts)

  • The step that moves a failed child's issue back and replaces its reaction now runs only for a record written within five minutes of the task's finish time. The stream stamps each record with the time of its write, so a delayed or repeated delivery decides as the first one would have.
  • Inside the window the step still repeats on purpose: nothing retries a failed call to the tracker, and the orchestrator's ttl stamp, one poll after the terminal write, is that retry.
  • Still as before: a late write records the verdict, refreshes the panel comment (that is how a preview reaches it) and rewrites the child row's updated_at.

Deploy and integ workflows removed

  • .github/workflows/deploy.yml and integ.yml are deleted. build.yml loses what fed them: the deploy dispatch input, the steps that wrote cdk/cdk.context.json, and the uploads of cdk.out and of the deploy intent. The required check keeps its name, build (agentcore).
  • The manual path goes too: the integ task of cdk/mise.toml, cdk/test/integ, its two test suites and the dependencies @aws-cdk/integ-runner and @aws-cdk/integ-tests-alpha. No automated test of a deployed stack exists now.
  • .gitleaks.toml loses the path exemption of the account-id rule for integ-runner snapshot directories, which matched nothing any more.
  • Tests, comments and documents that described the pipeline are adapted. ADR-013 records the change.

AWS Emulator 1.0.523 to 1.0.610

  • The pin and the README move. The suites were not run on 1.0.610 before this pull request was opened (no container engine was available). The emulator workflow here was their first run, and it passed: cdk 29 tests, cli 7, agent 44.
  • One assertion was changed ahead of that run: from 1.0.606 the iss claim of a Cognito ID token names cognito-idp.<region>.localhost:<port>, and the cli suite now expects that form. The value came from upstream's fix commit; the run confirmed it, and a follow-up commit brings the README's row on the claim in line.

What an operator or maintainer will notice

  • Guardrail: the first deploy with this change publishes one more version of the input guardrail, because its logical ID changes one last time. A guardrail already at Bedrock's quota (20 versions, not adjustable) must be cleaned up before that deploy. The deployment guide has the steps under "Deploys stop once the input guardrail reaches its version quota (Deploys stop once the input guardrail reaches its version quota #1079)". Old versions are never deleted automatically.
  • Secret files: a regular file that can be written but not replaced now fails where it used to be written in place: a file in a directory the user cannot write to, a file name too long to take the temporary suffix, and --output /dev/fd/N on macOS when N is a regular file. The error then names the temporary file.
  • CI: no deploy run and no integ run follow a build, and there is no integ-smoke status. build synthesizes the default stack and uploads neither cdk.out nor a deploy intent. Required checks are unchanged.
  • Until this merges, main's copies of both workflows still start after each build of this branch. Expect a failed deploy run and a pending integ-smoke. Neither is required.
  • Left in GitHub and AWS by the removal (the owner cleans these up): the environments deploy, diff and integ; the secret AWS_ROLE_TO_ASSUME; the variables AWS_REGION and AGENTCORE_AVAILABILITY_ZONES; integ runs still waiting for approval; the IAM role behind that secret and any stack the workflows left.

Not in this pull request

Verification

  • mise run build passed on the tree with all five changes. The last edits after it were the pin (1.0.609 to 1.0.610), wording in two documents, the secret-scan exemption and one assertion of an emulator suite.
  • On the head commit: mise //cdk:test, mise //cli:test, mise //web:test and the agent tests, and the security scans of the push hook (secrets, dependencies, SAST, the masking rules, Grype, Retire.js, zizmor, shellcheck, Bandit).
  • Independent review of every change, with the findings fixed or listed above.
  • Not run: the build and Trivy scan of the agent image (no container engine; the only image input this branch changes is contracts/coverage-thresholds.json, a data file the agent does not read) and anything that deploys. The emulator-backed suites ran in CI only (see above).

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

bgagent added 5 commits November 24, 2026 21:18
writeSecretFile truncated the file and then wrote it. A refreshed token
is saved this way, and a second bgagent process that read
credentials.json in between got an empty or partial file and reported a
valid login as corrupt. `bgagent login`, which the message advises, did
not help, and the next parallel run could fail the same way.

The content now goes to a temporary file beside the target, created
exclusively with mode 0600 under a name of its own, and a rename puts
it in place: a reader gets the old file or the new one. The function
is shared, so invite files, pending Linear consents and
`replay --output` are written the same way. A device, a FIFO and a
symbolic link are still written in place, because a rename would
replace the node or the link.

A regular file that can be written but not replaced now fails where it
used to be written in place: a file in a directory the user cannot
write to, and a file name too long to take the temporary suffix.

Closes #1080
Both workflows started after every build and did no work. deploy.yml
could deploy only for a `deploy` label or a dispatch input, and the
repository has no such label. integ.yml waited for an approval of the
`deploy` environment; its test step last ran on 2026-11-17 and failed.
The emulator-backed tests are the integration check that CI runs, and
no workflow uses an AWS account any more.

build.yml loses what fed the two: the `deploy` dispatch input, the
steps that wrote cdk/cdk.context.json (stack name, github:* tags, the
AZ override of AGENTCORE_AVAILABILITY_ZONES) and the upload of cdk.out
and of the deploy intent. Its one-value matrix stays, because it names
the required check `build (agentcore)`.

The manual path goes with them: the integ task of cdk/mise.toml, the
smoke app under cdk/test/integ, its two test suites, the ignore
patterns for it in the jest configuration and in their copy in
contracts/coverage-thresholds.json, and the two dependencies that
served it, integ-runner and integ-tests-alpha. Nothing ran the task
any more, and no run of it in CI had completed since the workflow's
call of it was repaired (PR 1048). No automated test of a deployed
stack exists now. The secret scan loses the path exemption for
integ-runner snapshot directories, which matched nothing any more.

Tests, comments and documents that described the pipeline say what is
true now. ADR-013 records the change and drops the accepted risk of
fork code running with the deploy role, which ended with the integ
workflow.
The reconciler runs for every write on the record of a finished task,
not only for the write that ended it. For a child that did not
succeed, each of those writes moved the child's issue back out of its
started state and replaced its reaction with the failed one, also
after a person had taken the work over: the preview of a later push
put a Linear issue from In Review back to Todo.

The stream delivers the new image only, so the write that ended the
task cannot be told from a later one by its content. The time between
the task's end and the write separates them. The step now runs for a
record written within five minutes of the task's finish time and not
for a later one. The finish time is completed_at, else updated_at;
the write time is the one the stream stamps on the record, so a
delivery that comes late, or again, decides as the first one would
have. Inside the window the step still runs for every record on
purpose: nothing retries a failed call to the tracker, and the
orchestrator's ttl stamp, one poll after the terminal write, is that
retry.

A late write still records the verdict, skips the dependents and
refreshes the panel, which is how a preview reaches it. Two comments
of the step said more than the code does and are corrected: the
revert demotes any issue in a running state, and a reaction is matched
by its emoji alone.

Closes #1073
createVersion() of the alpha library names the version resource after
an unresolved token (issue 38674 of aws/aws-cdk). aws-cdk-lib starts
its token counter at a random number, so the name differed from one
synthesis to the next and about nine deploys in ten replaced the
version of the input guardrail. Since PR 904 the replaced version is
retained,
because a retained version of the orchestrator function can still
name it. A long-lived stack therefore reached Bedrock's quota of 20
versions per guardrail, which cannot be raised, and deploys failed and
rolled back until versions were deleted by hand. A real change of the
guardrail, on the other hand, was published only by the same chance.

The stack now creates the version itself, under a construct id that
ends in a hash of the guardrail's CloudFormation properties (without
tags) and of the description. A deploy publishes a version when the
guardrail changed and only then, and the version stays retained. The
name is computed where the version is created, so synthesis fails
when the guardrail is changed after that. The network tests no longer
map the guardrail version id between the two topologies.

The first deploy with this change publishes one more version, because
the logical id changes one last time. A guardrail at its quota has to
be cleaned up first: see "Deploys stop once the input guardrail
reaches its version quota" in the deployment guide. Old versions are
not deleted by this change.

Closes #1079
The pin moves from 1.0.523 to 1.0.610, the newest release. The suites
were not run on it before this commit: the Docker engine of the
machine it was made on did not answer, so the emulator workflow of the
pull request is their first run.

One assertion is changed ahead of that run. From 1.0.606 the iss
claim of a Cognito ID token names a host in the loopback zone,
cognito-idp.<region>.localhost:<port>, where it named the endpoint.
The cli suite expects the new form, as upstream's fix commit and one
of its own records give it. With the old value the cli step would
fail and the agent suite, the step after it, would not run.

The README says what was not done. Nothing in it was probed again,
and it names the four statements that upstream's release notes and
fix commits say no longer hold as written: the iss claim, the
malformed expression forms, an MCP record that matches no schema
version, and the operations answered with 501. The package and image
sizes are those of the new version; the image size is computed from
the package, not measured.
@krokoko
krokoko requested review from a team and backgroundagents as code owners November 25, 2026 06:19
The emulator workflow of the pull request was the first run of the
suites on the new pin, and all three passed. The cli suite asserts
the iss claim of a Cognito ID token in the form it has since 1.0.606,
cognito-idp.<region>.localhost:<port>, so that form is observed now.

The README's row on the claim has the new form, the note on the pin
no longer lists it among the statements nobody observed, and the
release history names 1.0.606 beside the two earlier changes of the
claim.
ayushtr-aws
ayushtr-aws previously approved these changes Nov 25, 2026

@ayushtr-aws ayushtr-aws 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.

Approve with nits. All three fixes address their root cause, CI is green, and nothing below blocks merge. Item 1 is worth fixing or rewording in this PR.

Non-blocking

  1. cdk/src/stacks/agent.ts:119-147 — a filter added after publishGuardrailVersion is silently dropped. Reproduced: a guardrail with one denied topic, then publishGuardrailVersion, then addDeniedTopicFilter synthesizes cleanly with only the first topic in the template; without the publish call both appear. configuration() resolves the alpha library's cached Lazy props at construct time, so the later filter never renders and the validation re-reads the same cached value and passes. Same for a second PII, regex or word filter; a second content filter and addPropertyOverride do fail synthesis. No live impact today (AgentStack configures the guardrail only in its constructor), but the doc comment ("or synthesis fails") and the comment at 590-593 promise a guard that does not hold, and the failure mode is a weaker guardrail. Suggested: compute the hash at synthesis as Lambda's version hashing does (Lazy.uncachedString + overrideLogicalId), or state the freeze in the doc and add a test with a second filter of an existing kind (cdk/test/stacks/agent.test.ts:1331 covers only the empty-to-one case). Reproduced on aws-cdk-lib 2.261; the Lazy caching code is the same in 2.276.
  2. cli/src/config.ts:134-140 — a symlinked credentials.json is still truncated in place, so the dotfiles setup that cli/test/config.test.ts:200 supports can still hit #1080. The doc comment at 114-119 promises "never a truncated one" unconditionally. Suggested: temp-and-rename beside the realpathSync target, or qualify the comment.
  3. cli/src/commands/replay.ts:53 — replay --output follows a symlink at a user-chosen path (predates this PR). In a directory others can write to, a planted link redirects the bundle. The new comment "a link planted there is not followed" holds only for the temp name. Suggested: refuse a symlink for --output, or open with O_NOFOLLOW.
  4. cli/src/config.ts:122-131 — the rename needs write permission on the parent directory. The read-only directory case is disclosed in the description; a single-file bind mount of credentials.json would likely fail with EBUSY (not tested). Suggested: fall back to the in-place write on EACCES/EPERM/EBUSY.
  5. cli/src/commands/setup.ts:751 still says "local and CI deploys"; no workflow deploys now.
  6. scripts/aws-emulator/README.md:59,73,81 — three rows that upstream release notes contradict stay as written (the README says so at line 85). Probe them or mark the rows inline.

Nits

  • cli/src/config.ts:129-131: the finally removes a file it did not create on EEXIST, and a cleanup error replaces the original one.
  • cdk/src/handlers/orchestration-reconciler.ts:559: nothing is logged when a first terminal record is skipped as late (for example an agent clock more than five minutes slow).
  • cdk/test/handlers/orchestration-reconciler.test.ts:613: no case at exactly five minutes.
  • .github/workflows/build.yml:35,59: actions: write and the self_mutation_happened output look unused (predates this PR).
  • docs/research/aws-emulator-local-tests.md:44,60 describes the removed workflows as current.

Checked and found correct

  • Reconciler: every terminal writer sets completed_at, and no post-terminal write (ttl stamp, screenshot fields, PR outcome) moves updated_at, so the fallback is not defeated. ApproximateCreationDateTime is epoch seconds; the NaN paths keep the old behavior.
  • Guardrail: every consumer pins the published version, none reads the draft. The hash is stable across processes, env-agnostic vs concrete environments, and with stack tags applied. A→B→A is safe for CloudFormation. ApplyGuardrail IAM is unaffected, and a wrong version fails closed.
  • CLI: regular and missing targets are replaced atomically at 0600; the lstat-to-rename window cannot write through a link.
  • CI and docs: no dangling references to the removed workflows, the required check name is unchanged, no coverage floor moved, the .gitleaks.toml change narrows the exemption, all seven doc sources match their mirrors, ADR-013 is consistent. Bootstrap synth-coverage is not applicable (no new resource type).

Governance

#1073, #1079 and #1080 are approved and the branch name is valid. The three issues carry no priority label or assignee, and the workflow removal and emulator bump have no issue of their own.

Not run locally: the PR's test suites (relied on CI) and anything that deploys.

@isadeks isadeks 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.

Reviewed the diff at 00a310d3 and live-tested the guardrail change on a long-lived dev stack (this PR merged onto the build that stack was running). The three items marked important inline are the ones I'd like fixed before merge; the rest are suggestions and nits.

Live test: guardrail version (#1079)

Step Result Published versions
Before stack on the previous build 11
Deploy 1 UPDATE_COMPLETE 12
Deploy 2, same tree, fresh synth UPDATE_COMPLETE 12
  • Deploy 1 created InputGuardrail/Version233b14ea39532000, retained the old version resource (DELETE_SKIPPED), and all 10 functions that carry GUARDRAIL_VERSION picked up the new number.
  • Deploy 2 was a real stack update (the RepoConfigCR timestamp churn). The fresh synth produced the same logical ID and CloudFormation raised no AWS::Bedrock::GuardrailVersion event.
  • cdk diff before deploy 1 showed no IAM role changes and no stateful replacements. An error scan of the stack's functions after both deploys was clean.

So the fix does what the description says: one extra version on the first deploy, none on a repeat deploy.

Not covered live: the reconciler change (#1073) and the credentials change (#1080). The comments on those are from reading the code.

Two notes without an inline anchor

  • .gitignore: removing the rules for /cdk/test/integ/*.snapshot/ and /cdk/test/integ/cdk-integ.out.*/ makes leftover integ-runner output in existing checkouts untracked and committable (bundled Lambda assets, roughly 100 MB), and the gitleaks path exemption is gone as well. Keeping the two ignore lines for a while, or telling contributors to delete cdk/test/integ/, avoids an accidental git add ..
  • docs/research/aws-emulator-local-tests.md (around lines 266, 289, 401) still describes deploy.yml, integ.yml and mise //cdk:integ as live. A dated note that they were removed would do.

Comment thread cli/src/config.ts Resolved
Comment thread cli/src/config.ts Resolved
Comment thread cli/src/config.ts Resolved
Comment thread cdk/src/stacks/agent.ts Resolved
Comment thread cdk/src/stacks/agent.ts Resolved
Comment thread scripts/aws-emulator/Dockerfile Resolved

@isadeks isadeks 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.

Requesting changes for the three items marked important in my review above (#1084 (review)):

  1. cli/src/config.ts: no fallback when the secret file cannot be replaced (bind-mounted credentials.json).
  2. orchestration-reconciler.ts: the late-write guard never fires for a record without completed_at, so #1073 remains for those.
  3. orchestration-reconciler.ts: a settle that fails inside the window is never retried once the window has passed.

The guardrail fix itself is confirmed on a deployed stack and looks good. The other comments are suggestions and nits, fine as follow-ups.

bgagent added 5 commits November 25, 2026 18:12
Since the write through a temporary file and a rename, a file that
can be written but not replaced failed: a credentials.json mounted
into a container on its own (the rename onto a mount point answers
EBUSY), a file in a directory that takes no new file,
`--output /dev/fd/N` on macOS when N is a regular file, a name or a
path too long to take the temporary suffix. For credentials.json
every token refresh failed there, where the code before #1080 worked.

When the temporary file cannot be created or the rename fails with
EACCES, EPERM, EROFS, EBUSY, EXDEV, ENOENT or ENAMETOOLONG, the file
is now written in place. In a shared directory such as /tmp another
user can make the rename fail on purpose, so the write in place is
stricter than the old one: an existing file is made owner-only before
the content goes in, and only if it is the user's own (root: any
file); a file that was missing is created exclusively. For a file
written in place the race of #1080 remains, and the comment says so.

A symbolic link that leads to a regular file is resolved, and that
file is replaced beside its real path: the link stays, and a
credentials.json that is a link no longer has the race. Because links
are followed on purpose, a link, a FIFO, a socket or a directory
found at the path is refused when it belongs to another user (not
root, not the owner of its directory) or has a second hard link:
`replay --output` takes a path that can be in a directory others
write to. A device is written whoever it belongs to: only a
privileged user can make one. The entry is examined once and used by
its name afterwards. In a directory with the sticky bit only the
user, root and the owner of the directory can exchange it in between,
and for root also the owner of a file that root writes in place. In a
directory without it anyone who may write there can, and the write
then follows a planted link. The comment of writeSecretFile says so.

The temporary file is opened exclusively and removed only by the call
that created it, and an error of the cleanup no longer replaces the
first error. A process killed between the write and the rename leaves
the temporary file, owner-only: the comments of writeSecretFile and
of takePendingConsent say so. knip.json names mkfifo, which a test
uses to make a FIFO.

Not run: a rename onto a real mount point (no container engine), and
anything as root or on Linux before CI.
Two gaps of the settle window that this branch added.

The finish time of a record without completed_at was its updated_at.
A late write that moved updated_at would have passed for the write
that ended the task. updated_at is not read any more. A record is
judged by its two times only when it carries both; one that lacks
completed_at or the stream's stamp is late once the child's row
already holds the failed verdict.

A settle that failed inside the window was never retried after it,
where every later write used to be the retry. A try inside the window
that did not land (a call threw, or the reaction call answered false,
which is how the Linear adapter reports a tracker that fails) now
leaves the task's id on the child's row, in the new optional
attribute unsettled_task_id. The first record after the window that
finds the mark runs the step once more, however late it was written,
and the mark is removed after that try whatever it did: a mark that
stayed would repeat the step on every later write, which is #1073.

Not covered, and said in the comment of the step: only a later write
on the task record triggers that try; it is the last one, so the
settle is lost when the tracker is still down then (a warning is
logged); a state call that failed alone is not owed, because the
adapter answers false both for a failed request and for nothing to
move; the try after the window can move back an issue that a person
has taken over by then. The mark is read with the rows by a query
that is not strongly consistent, and its removal can fail: either
can bring one more try after the window, also when nothing is owed.

A record that the step leaves out as late is logged, as a warning
when it is the record that brought the verdict to the row. Tests pin
the boundary: 300 s after the end settles, 301 s does not. A comment
in linear-feedback.ts now names this step as the one caller that
reads the answer of the reaction swap.
publishGuardrailVersion() renders the guardrail at the call, and the
alpha construct keeps what it rendered. A filter added afterwards was
missing from the template without an error (a second denied topic,
PII, regex or word filter), and the validation, which compared the
same kept rendering, passed. The comment promised that synthesis
fails.

The validation now also compares the JSON text of what the construct
renders from, the seven filter lists, the two tiers and the
cross-Region configuration, with what it was at the call. The hash is
computed from the same input as before, so the version keeps its name
and a stack deployed from the previous commits publishes nothing new.

Synthesis fails when the guardrail's rendered properties, or the
filters, tiers and cross-Region configuration they are rendered from
(compared as JSON text), are no longer what they were when its
version was published. What the construct's add methods append
between the call and the synthesis always fails it. The comparison is
not complete: the doc comment says what it compares, and that a
cached Lazy value in a property keeps what it produced at the call.
Other ways past it are not closed: they take a cast, a filter class
of the caller's own, a rebuilt CfnGuardrail, or a change made while
synthesis validates.

A test fails when a later version of the alpha library renders from
one more member that is a list or is read by a generateCfn method.
The deployment guide's entry on the version quota now says to count
the versions before the first deploy with the fix.
setup.ts: the hint after `--no-deploy` and two comments named a CI
deploy. No workflow deploys since deploy.yml was removed, so the hint
says "every deploy of this stack", and a test pins it.

scripts/aws-emulator/README.md: the three statements that upstream's
fix commits contradict are marked "Not probed again on 1.0.610" where
they stand, with what upstream says changed and from which release.
None of the three was observed on 1.0.610: no container engine was
available.

docs/research/aws-emulator-local-tests.md: a dated note in the status
line says that what the document tells about deploy.yml, integ.yml,
`mise //cdk:integ` and the integ smoke describes the earlier state,
and six passages carry a marker that points to it. The other mentions
stay as the record of 2026-11-15 that they are.

.gitignore: the two lines for the integ runner's output are back. A
checkout that ran the integ test may still have those directories,
about 100 MB by the comment these lines had, and without the lines
`git add .` would stage them.
The job asked for `actions: write`, "upload-artifact when
self-mutation is detected". The pinned upload-artifact takes no
token: it uploads, and deletes for `overwrite`, through the results
service with the run's own runtime token. upgrade-main.yml runs the
same step under `contents: read`.
@krokoko

krokoko commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for both reviews. The changes are in the commits after 00a310d3; the inline threads are answered one by one. Here are the items that have no thread.

Review of ayushtr-aws

  1. A filter added after publishGuardrailVersion() is dropped. Reproduced, and fixed in 4be987c. The call renders the guardrail, and the alpha construct keeps what it rendered. The validation now also compares the JSON text of the members the construct renders from (the seven filter lists, the two tiers, the cross-Region configuration) with what they were at the call. Your case, one denied topic, the call, then addDeniedTopicFilter, fails the synthesis. The tests cover a second filter of each of the seven kinds, a first filter beside the other list of a shared policy, and changes that no method of the construct makes (a filter or the cross-Region object changed in place, a list or a tier replaced); 16 of the 18 rows fail with the function as it was at 00a310d3. The version keeps its name, so a stack deployed from the reviewed head publishes nothing new. The name is not computed at synthesis: a guard test forbids overrideLogicalId in agent.ts (fix(agent): log-delivery pin table is keyed by stack name but holds per-account state, so it breaks deploys it was meant to protect #703), and that variant renames the version.

    The comparison is not complete. The doc comment says what the validation compares, and names the first of the ways past it that I reproduced and left open: a cached Lazy value in a property keeps what it produced at the call. The others take a cast (a token swapped inside a filter), a filter class of the caller's own that answers through an accessor, a CfnGuardrail that is removed and built anew, a call made while the synthesis already validates or with skipValidation, or a rendering of the guardrail before the call. What the construct's add... methods append between the call and the synthesis always fails it.

  2. A symbolic link is still truncated in place. Fixed, see the thread on config.ts line 134.

  3. replay --output follows a link. Done in writeSecretFile, on the lstat that selects the branch (a check in replay.ts would sit before the network round trip). A link, a FIFO, a socket or a directory at the path is refused unless it belongs to the user, to root or to the owner of its directory, and, a directory excepted, also when it has a second hard link. A device is written whoever it belongs to: only a privileged user can make one. Where there are no user ids (Windows) nothing is refused.

    Still accepted: the user's own links, /dev/stdout and /dev/null. /dev/null, and a link that leads nowhere or to a device, are written in place as before; a link to a regular file is resolved and that file replaced (item 2). --output /dev/stdout wrote what main writes in the cases run on macOS (into a file with > and >>, into a pipe). On Linux it is read from the code and not run: the link resolves there to the path of the file that stdout is, and that file is replaced by its path, so a descriptor that was open on it keeps the old file.

    The comment states the limits: only the entry at the path is examined, and what follows goes by name after the look. Your "checked and found correct" line on the lstat-to-rename window still holds where the look finds a regular file or nothing and the file is put in place by the rename or created exclusively: neither follows a link. Two steps are new and land in whatever is under the name by then: a link at the path is resolved on purpose, and a file that cannot be replaced is written in place. In a directory with the sticky bit only the user, root and the owner of the directory can put something else under the name, with one exception: a file of another user that root writes in place can be exchanged by its owner. In a directory that others can write to without the sticky bit anyone can, and can also remove the temporary file to bring on the write in place.

    trace download --output still writes with createWriteStream and follows a link; it is not changed here: fix(cli): trace download --output follows a planted link and creates the file with the default mode #1090.

  4. The rename needs write permission on the directory. Fixed, see the thread on config.ts line 128. This changes the first half of the CLI line of your "checked and found correct" list: a regular or missing target is replaced atomically at 0600 unless it cannot be replaced; then it is written in place, owner-only, and for that file the race of bgagent reports a valid login as corrupt when several CLI processes run at once #1080 remains.

  5. "local and CI deploys". Reworded in the three places of setup.ts that had a CI deploy, and the printed sentence is pinned by a test.

  6. Three README rows. Marked in place, see the thread on the Dockerfile.

Nits:

  • The finally in config.ts. The temporary file is opened exclusively before the try, so after EEXIST nothing is removed, and the cleanup and the close after a failed write have a try of their own: the first error is the one thrown.
  • No log line for a late first record. A record that step 1b leaves out as late is logged with both times (not on a surface that has neither call, such as Jira, where the step does nothing); it is a warning when the record is the one that brought the verdict to the row.
  • No case at exactly five minutes. Added: 300 s after the end settles, 301 s does not. The reconciler line of your "checked and found correct" list changes with this round: updated_at is not read any more, so there is no fallback left, and a record that lacks either of its two times no longer keeps the old behaviour: it is judged by the child's row (thread on line 561).
  • build.yml. actions: write is removed in a03d778; the job keeps contents: read. The line was there for upload-artifact, and the pinned version takes no token: upgrade-main.yml runs the same step with overwrite: true under contents: read, and its upload passed in the scheduled run of 2026-11-25. The next build run of this pull request is the first without the permission: its cache steps run in it, its two artifact steps only after a failed build or a self-mutation. The job output self_mutation_happened is unused, as you say: the workflow has one job, no workflow reads it through needs or workflow_call, and the two later steps read the step output of the same name. It is still there; its removal is not in this pull request.
  • docs/research/aws-emulator-local-tests.md. A dated note in the status line, which says that everything the document tells about the two workflows, the integ task and the integ smoke describes the earlier state, and a marker at six passages: the two rows you named (lines 44 and 60), the CI paragraph (266), the row on the real-AWS integ smoke (289), open decision 7 (381) and the lead-in of Appendix A (388). Five other mentions (lines 18, 141, 147, 295, 364) are left to that note.

Governance: the removal of the workflows and the emulator move have no issue of their own because I asked for both directly, as the description says. I will set the priority labels and the assignees on the three issues.

Notes of isadeks without a thread

  • .gitignore. The two lines are back, under a comment that says what they are for now and that rm -rf cdk/test/integ removes the leftovers. The gitleaks path exemption stays out: the secret scans read git history and the staged index, so an ignored directory reaches none of them.
  • docs/research/aws-emulator-local-tests.md. As above: the status line and a marker at lines 266, 289 and above the appendix block.

@isadeks isadeks 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.

Approving at a03d7784. The three items I requested changes for are fixed, and I checked each one rather than only reading the replies:

  • Secret file that cannot be replaced (3ddbe375): with credentials.json bind-mounted as a single file into a container, 00a310d3 fails with EBUSY and the head writes the file, owner-only.
  • Record without completed_at (f9c4c73c): the new test for that case fails with the 00a310d3 handler and passes on the head.
  • Settle that did not land (f9c4c73c): same check with the owed-settle test, fails before and passes now.

The CLI config tests and the reconciler and agent stack tests pass locally on the head. A fresh synth of the head gives the same guardrail version logical ID as the build I deployed, so 4be987c9 does not publish another version.

Fine with #1088 as the follow-up for the quota preflight, and with the documented limits (the temporary file left by a killed process, the single late retry, the emulator table rows marked as not probed again). Thanks for the thorough replies.

@krokoko
krokoko enabled auto-merge November 26, 2026 01:01
@krokoko
krokoko added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 114795e Nov 26, 2026
8 of 9 checks passed
@krokoko
krokoko deleted the fix/1073-1079-1080-reconciler-guardrail-credentials branch November 26, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants